Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Simple middleware and method for Browserify to add [Sass](http://sass-lang.com)

[![Build Status](https://travis-ci.org/davidguttman/sassify.svg?branch=develop)](https://travis-ci.org/davidguttman/sassify) [![Dependency Status](https://david-dm.org/davidguttman/sassify.svg)](https://david-dm.org/davidguttman/sassify) [![devDependency Status](https://david-dm.org/davidguttman/sassify/dev-status.svg)](https://david-dm.org/davidguttman/sassify#info=devDependencies)

_Currently breaks in some cases on node 0.11.x with latest version (2.0.1) of node-sass as documented in [node-sass issue #550](https://github.com/sass/node-sass/issues/550). This is also the reason why node 0.11 is currently not supported. Use at your own risk (though no actual risk is involved, it might just not work)._

# Example

If you have a file `entry.js` that you want to require some css from `style.scss`:
Expand Down Expand Up @@ -56,7 +54,10 @@ gulp.task('build', function(done) {
sourceMap: false, // Add source map to the code
// when 'no-auto-inject' is set to `true`, `require('./style.scss')` won't inject styles
// it will simply return the css as a string
'no-auto-inject': false
'no-auto-inject': false,
flushcssoutput: function(data){
fs.appendFileSync('build/index.css', data);
}
});

result.add('./entry.js');
Expand Down
7 changes: 7 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ module.exports = tools.makeStringTransform('sassify', {
}
var out = "module.exports = " + exp + ";";

// flush css (not scss or sass) out to a callable function
// client can then call this function and (if required) push the output to a .css file
// potential use in generating css output to push to a prod environment
if (typeof options.flushcssoutput === "function") {
options.flushcssoutput(css.css.toString());
}

done(null, out);
};

Expand Down