meteor-css-modules icon indicating copy to clipboard operation
meteor-css-modules copied to clipboard

Allow passing options to node-sass (includePaths...)

Open yched opened this issue 6 years ago • 2 comments

I'm in the process of moving an existing app, with a large existing global SCSS codebase over to css-modules.

Since many of those new component-scoped styles are using vars / mixins provided by the global SCSS definitions, I find myself doing a lot of tedious relative imports :

@import '../../[...however_deeply_nested_my_component_is...]/my_root_scss_folder/variables/colors';

Those relative paths are tedious to get right, get in the way of refactoring, and all in all add mental barriers to leveraging the existing vars and mixins.

node-sass seems to accept an includePaths option, but meteor-css-modules currently only calls node-sass with a hardcoded set of options (https://github.com/nathantreid/meteor-css-modules/blob/master/scss-processor.js#L88)

Would it be possible to allow custom node-sass options to be provided in composer.json ?

yched avatar Dec 28 '17 13:12 yched

I’ll look into that, however did you know you can use absolute-style paths relative to the root of the Meteor project directory? For example if your my_root_scss_folder is stored at the root of your project then import ‘/my_root_scss_folder/variables/colors’; should work from any file. Updating the documentation is on my TODO list...

akanix42 avatar Dec 28 '17 13:12 akanix42

Awesome - that's good enough for me :-) Thanks!

yched avatar Dec 28 '17 16:12 yched