Created
October 9, 2015 05:44
-
-
Save ryanseddon/e76fd16af2f8f4f4bed8 to your computer and use it in GitHub Desktop.
Mocha compiler for css-module support in tests using sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mocha --compilers js:babel/register,js:./test/css-modules-compiler.js --recursive -w |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
}); |
As of babel 6 it's rather mocha --compilers js:babel-core/register,js:./test/css-modules-compiler.js
babel-core
instead of just 'babel`
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
@stipsan and @ryanseddon thank you very much for taking the time to share!