akanix42 / meteor-css-modules

MIT License
92 stars 20 forks source link

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

Open yched opened 6 years ago

yched commented 6 years ago

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 ?

akanix42 commented 6 years ago

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...

yched commented 6 years ago

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