davidguttman / cssify

Simple middleware for Browserify to add css styles to the browser.
122 stars 19 forks source link

Import CSS from other modules? #23

Open trusktr opened 9 years ago

trusktr commented 9 years ago

Suppose I do

require('foo/style.css')

where foo is a module in node_modules of my application. This file doesn't get cssified. Is there a way to do this? I tried cssify as a global transform in my application, but that screws with dependencies that have cssify as their own local transform.

davidguttman commented 9 years ago

Asked @substack about it. Looks like it needs a bit more thought, but the gist is that it's something that https://github.com/substack/module-deps would need to handle, but npm dedupe could put deps unexpected places. There's also the issue of multiple versions of the same package where one is transformed and the other is not...

trusktr commented 9 years ago

Interesting. About having multiple of the same deps, maybe the transform would be applied to the dep of the module that is using the require, so it resolves to it's particular dep. I've no idea how this would work, but I suppose it'd be similar to how nodejs CommonJS gets the correct dep for a module in non-browserify cases.