rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

SASS Loader doesn't use next importer

Open WalterWeidner opened this issue 5 years ago • 0 comments

We've got some custom import configuration that needs to be handled outside of this plugin's SASS Loader. In reading the documentation, it appears that we can pass our own SASS importer into the plugin as an option. However, when it fails to pass the regex on https://github.com/egoist/rollup-plugin-postcss/blob/master/src/sass-loader.js#L42 it returns the same file (which doesn't let Node SASS move on to the next importer).

Node SASS says this in their documentation:

importer can be an array of functions, which will be called by LibSass in the order of their occurrence in array. This helps user specify special importer for particular kind of path (filesystem, http). If an importer does not want to handle a particular path, it should return null. See functions section for more details on Sass types.

See their README

The way the SASS loader is written passes this.options.importers to Node SASS, it just won't be called when the import doesn't match your regex. Was this intentional?

We can always specify our own loader instead of using SASS loader but it seems a bit redundant.

WalterWeidner avatar Jan 07 '21 15:01 WalterWeidner