cheton / browserify-css

A Browserify transform for bundling, rebasing, inlining, and minifying CSS files.
http://cheton.github.io/browserify-css/
MIT License
144 stars 22 forks source link

adding support for deduped node modules #21

Closed brodrigu closed 9 years ago

brodrigu commented 9 years ago

When using npm3 or when deduping modules such that a given module is moved up the tree to one of its parents node_modules folder, @import statements are failing as the target resource is no longer in the modules local node_modules folder.

@import "node_modules/shared-module/style.css

This improvement will look up the tree and find the first shared-module and use that path to find style.css

brodrigu commented 9 years ago

ah good call, I'll fix.

brodrigu commented 9 years ago
myapp/
    node_modules/
        my-shared-module/
            styles.css
        my-module/
            node-modules/
                irrelevant-modules/
                    index.js
            my-file.js //require('my-styles.css');
            my-styles.css //@import "node_modules/my-shared-module/style.css
        my-other-module/
            node-modules/
                foo/
                    index.js
            other-file.js //require('other-styles.css');
            other-styles.css //@import "node_modules/my-shared-module/style.css