defunctzombie / npm-css

Require css from npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Process Sass?

triblondon opened this issue · comments

If my modules and my project both use Sass, is there a way npm-css could be used in conjunction with Sass to combine all the modules via the @import statements, and then run Sass on the result?

Or, since Sass already supports @import, do something to transform the content Sass sees, so that it sees paths to modules' main sass files rather than just the name of the module?

Browserify has transforms, which allow you to do this, but sass compilers don't seem to offer the opportunity to intervene in the process. Sass also has watch mode, where files are continuously recompiled every time you make a change to a file or it's dependencies, which seems to complicate the issue.

I tried to get this to work with LESS.

I ended up patching the less engine myself ( https://github.com/Colingo/npm-less#npm-less , https://github.com/Colingo/npm-less/blob/master/index.js#L15 ).

Your best bet might be to monkey patch the sass engine. The hard part is finding a node based implementation of sass otherwise you have to implement the algorithm in ruby.