Skip to content

Instantly share code, notes, and snippets.

@ryanseddon
Created October 9, 2015 05:44
Show Gist options
  • Save ryanseddon/e76fd16af2f8f4f4bed8 to your computer and use it in GitHub Desktop.
Save ryanseddon/e76fd16af2f8f4f4bed8 to your computer and use it in GitHub Desktop.
Mocha compiler for css-module support in tests using sass
mocha --compilers js:babel/register,js:./test/css-modules-compiler.js --recursive -w
var hook = require('css-modules-require-hook');
var sass = require('node-sass');
hook({
extensions: ['.scss'],
preprocessCss: function (css) {
var result = sass.renderSync({
data: css
});
return result.css;
}
});
@thetallweeks
Copy link

Has anyone had issues with empty css files throwing?

throw new Error('No input specified: provide a file name or a source string to process');

It's coming from an external dependency so I can't remove the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment