Karma preprocessor to compile sass and scss files with node-sass.
npm install node-sass @metahub/karma-sass-preprocessor --save-dev
All the node-sass options can be passed to
In addition the preprocessor accept a
transformPath function, to rewrite the path on which the files are deployed on the Karma webserver. If not specified, the processed files will be accessible with the same paths as the originals with the extension
.css instead of
.scss. For example
test/fixtures/myStyle.scss will be deployed as
Note: Karma can auto-load plugins named
karma-* (see plugins). Unfortunatly it doesn't work with scoped packages, therefore
@metahub/karma-sass-preprocessor has to be explicitly added to the
plugins configuration. In order to continue to automatically load other plugins you can add
karma-* to the
@metahub/karma-sass-preprocessor embed its own watcher to monitor sass dependency, therefore only the sass entry point has to be configured in Karma. If Karma is configured with
autoWatch: true, the modification of an imported sass partial will trigger a new build and test run.