Skip to content

Instantly share code, notes, and snippets.

@pahund
Last active May 25, 2017 08:11
Show Gist options
  • Save pahund/829f245cecaa81301bd59c3dc835c05e to your computer and use it in GitHub Desktop.
Save pahund/829f245cecaa81301bd59c3dc835c05e to your computer and use it in GitHub Desktop.
Using css-modules-require-hook for testing React components styled with Sass
const hook = require('css-modules-require-hook');
const sass = require('node-sass');
hook({
extensions: ['.scss'],
preprocessCss(css, filepath) {
const result = sass.renderSync({
data: css,
includePaths: [path.resolve(filepath, '..')]
});
return result.css;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment