Skip to content

Commit a24cafc

Browse files
committed
add readme, fix package, small fix
1 parent e47707f commit a24cafc

3 files changed

Lines changed: 71 additions & 3 deletions

File tree

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
var output = exporter.get_value(value);
5151
if (opt.extend && 'SassMap' === value.constructor.name) {
5252
try {
53-
_.defaults(output, JSON.parse(fs.readFileSync(path + file.getValue())));
53+
_.defaults(output, JSON.parse(fs.readFileSync(path + '/' + file.getValue())));
5454
}
5555
catch (e) {
5656
console.log(e);
5757
}
5858
}
59-
fs.writeFileSync(path + file.getValue(), opt.prefix + JSON.stringify(output, null, ' ') + opt.suffix);
59+
fs.writeFileSync(path + '/' + file.getValue(), opt.prefix + JSON.stringify(output, null, ' ') + opt.suffix);
6060
return value;
6161
}
6262
};

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,14 @@
1616
"dependencies": {
1717
"fs": "0.0.2",
1818
"lodash": "~3.10.1"
19-
}
19+
},
20+
"devDependencies": {},
21+
"repository": {
22+
"type": "git",
23+
"url": "git+https://github.com/Punk-UnDeaD/node-sass-export.git"
24+
},
25+
"bugs": {
26+
"url": "https://github.com/Punk-UnDeaD/node-sass-export/issues"
27+
},
28+
"homepage": "https://github.com/Punk-UnDeaD/node-sass-export#readme"
2029
}

readme.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# node-sass-export
2+
3+
**node-sass-export** provide export function fo use with Node-sass [function option](https://github.com/sass/node-sass#functions--v300---experimental).
4+
5+
## Usage
6+
7+
```
8+
var export_sass = require('node-sass-export');
9+
sass.renderSync({
10+
// ...
11+
functions: export_sass('export_path')
12+
});
13+
```
14+
```
15+
$breakpoints: export('lib/breakpoints.json', $breakpoints);
16+
```
17+
$breakpoints has been exported to export_path/lib/breakpoints.json
18+
```
19+
{
20+
"small": 960,
21+
"mini": 768,
22+
"micro": 720,
23+
"wide": 1230
24+
}
25+
```
26+
27+
### Usage with Gulp
28+
```
29+
gulp.src('theme_path/sass/*.scss')
30+
.pipe(sass({
31+
functions: export_sass('export_path')
32+
}))
33+
```
34+
35+
### Options:
36+
37+
#### Another export function name
38+
```
39+
{ functions: export_sass('export_path', 'antiexport') }
40+
```
41+
```
42+
$breakpoints: antiexport('lib/breakpoints.json', $breakpoints);
43+
```
44+
45+
#### Extend json (not rewrite)
46+
```
47+
$breakpoints: export('lib/breakpoints.json', $breakpoints, (extend:true));
48+
$breakpoints: export('lib/breakpoints.json', $other_breakpoints, (extend:true));
49+
```
50+
51+
#### Export to js file
52+
```
53+
$breakpoints: export('lib/breakpoints.js', $breakpoints, (prefix:'var breakpoints = ', suffix:';'));
54+
```
55+
56+
#### Usage with another functions
57+
```
58+
{ functions: _.extend(export_sass('export_path'), {'foobar()': function(){}}) }
59+
```

0 commit comments

Comments
 (0)