wilson428 / node-lessify

LESS precompiler plugin for Browserify v2
MIT License
24 stars 13 forks source link

add some sort of global import #17

Closed andrepadez closed 7 years ago

andrepadez commented 9 years ago

use case: I have a /global.less file, that contains variable initializations. I want to use those variables across a lot of the less files that are required. Apparently, for now, i have to import that 'global.less' file from every less file that needs those variables, if i don't compilation breaks on each file. This makes for the css compiled from global.less to be inserted in all the style tags, and contribute to a larger bundle.js file.

desired behaviour: i import /global.less from one of the files, and it becomes accessible for every file that is trying to use its variables.

Is this already possible? how can i do it? If not, would you consider implementing it?

Thanks

DXCanas commented 7 years ago

This makes for the css compiled from global.less to be inserted in all the style tags, and contribute to a larger bundle.js file.

If my understanding is correct, less handles repeated @include statements so that it isn't compiled multiple times using the default once option

I believe this was intentional, to keep the styles in the file explicit.

Currently, you can set a global file path using the path option, but you do have to explicitly include @import in every file you intend to use those styles.