Skip to content

Commit c5d0b44

Browse files
author
Adam Simpson
committed
📝 add README
1 parent f56a027 commit c5d0b44

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[![CircleCI](https://circleci.com/gh/sparkbox/splinter.svg?style=shield)](https://circleci.com/gh/sparkbox/splinter)
2+
3+
scss-splinter enables the creation of multiple stylesheets from a common set of modules with minimal effort via SCSS mixins and functions.
4+
5+
## Usage
6+
7+
scss-splinter accepts an options object that specifies a `partial` and a `base`.
8+
9+
```js
10+
const parse = require('scss-splinter');
11+
12+
parse({
13+
partial: 'src/scss/_brands.scss',
14+
base: 'src/scss/_base.scss',
15+
})
16+
```
17+
18+
1. Partial is the name of the file that scss-splinter will generate with "split" code, e.g. code that is specified in the matching mixin or sass-function.
19+
20+
2. Base is the name of the main `sass` index file in a project. This is the file scss-splinter will use to find all the files it needs to parse.
21+
22+
scss-splinter fills the `partial` file with "split" `scss` and returns a promise that contains "global" `scss`. It's up to the project to determine what to do with this global string. One approach would be to run the string through `node-sass` and write the compiled `css` to a file.
23+
24+
```js
25+
const fs = require('fs');
26+
const parse = require('scss-splinter');
27+
const nodeSass = require('node-sass');
28+
29+
parse({
30+
partial: 'src/scss/_brands.scss',
31+
base: 'src/scss/_base.scss',
32+
})
33+
.then((scss) => {
34+
const compiledGlobal = nodeSass.renderSync({
35+
data: scss,
36+
});
37+
38+
fs.writeFileSync('global.css', compiledGlobal.css.toString());
39+
});
40+
```

0 commit comments

Comments
 (0)