Support '*' wildcard for @import
It would be nice if less.js supported wildcards for the @import function. For example:
Directory structure:
.
├── main.less
└── some
└── dir
├── a.less
├── b.less
└── c.less
Then in main.less I can import all the files inside some/dir:
@import 'some/dir/*'
If this feature is relevant and worth considering I'm happy to submit a PR. Let me know what you think. Thanks!
duplicate of https://github.com/less/less.js/issues/1181
P.s a pr would be great.. we welcome contributions.. please add a comment if you want help and do the request against the 1.5.0 branch.
I just now noticed that you' offered to do a PR. That would be great, what lib(s) are you thinking of using? How would you do this to account for node.js vs browser etc.?
I'm not sure how I would implement the feature in the browser. Do you have any thoughts @jonschlinkert?
No thoughts on it lol, I was hoping you did. The general consensus has been that only node.js should be supported, but who knows I thought maybe you had some ideas for how it would work in the browser and I didn't want to discourage it prematurely.
What about dependencies? Minimatch?
@cowboy, I noticed you created https://github.com/gruntjs/grunt-glob and https://github.com/gruntjs/grunt-file, any chance those are happening in the short-term(er), or are those still in the "maybe" stage? IMO having those available as utility libs could be useful for this kind of feature.
@jonschlinkert grunt-glob will eventually be the new name of globule, which you can use right now. grunt-file is going to take a little longer, because I need to figure out how I'm going to handle logging first.
@cowboy, thanks
so @luk3thomas I'll just wait and see what you come up with and we can go from there. thanks!
Ok thanks, @jonschlinkert. I'll take a look and post some thoughts later
:+1:
I have an idea how to support a number of "node" features like this one with some rewriting to browser mode.
I have an idea how to support a number of "node" features
start thinking out loud on here then lol. let's get these ideas flowing so people can build on them!
there should be a well defined interface to the environment.. 1.5.0-wip is closer to that though not there yet. We should add a function on the environment importer that asks the importer if the url might be for multiple imports, then another function with callback that returns those imports. Then we add a little bit of extra code to the import visitor that calls these functions in order to get a list of imports and expands the one import into multiple before continuing with the standard import process.