question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support file globbing for @imports

See original GitHub issue

See: https://github.com/isaacs/node-glob, and ~~https://github.com/isaacs/minimatch~~ https://github.com/jonschlinkert/micromatch

I use these often in projects. It would be pretty awesome to be able to do the following and not have to specify individual files:

@import "mixins/*.less";
@import "components/**/*.less"; 

After only a few minutes of using these patterns they become second nature. It might even help with some of the other import issues.


Implemented via plugin: less-plugin-glob.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:70 (24 by maintainers)

github_iconTop GitHub Comments

4reactions
just-boriscommented, Feb 11, 2015

Because I can’t wait resolution of this issue anymore, I write plugin which does it, and use it for my projects. https://github.com/just-boris/less-plugin-glob Less allow to create custom file loaders for @imports. I’ve create this one which resolves imports with globs in import path. Any feedback will be appreciated.

2reactions
equinusociocommented, Apr 15, 2015

For globbing in less you can simple simple run this in your project,

npm install less-plugin-glob --save-dev

then add this to your Gruntfile in the options group of your less task

plugins: [require('less-plugin-glob')]

The result is something like this:

···
options: {
    compress: true,
    yuicompress: true,
    optimization: 2,
    cleancss: true,
    sourceMap: false,
    sourceMapFilename: 'css/maps/style.css.map',
    plugins: [require('less-plugin-glob')]
},
···

Now in your .less file you can write this:

···
@import "commons/**/*";
@import "basic/**/*";
···
Read more comments on GitHub >

github_iconTop Results From Across the Web

glob — Unix style pathname pattern expansion ... - Python Docs
This function can support paths relative to directory descriptors with the dir_fd parameter. If recursive is true, the pattern “ ** ” will...
Read more >
glob – Filename pattern matching - Python Module of the Week
import glob for name in glob.glob('dir/*'): print name. The pattern matches every pathname (file or directory) in the directory dir, without recursing ...
Read more >
Python Glob: Filename Pattern Matching - PYnative
Python glob module to find files and folders whose names follow a specific pattern. Search files recursively with wildcard characters.
Read more >
Does Snowpack support importing files using a glob pattern?
Currently Snowpack doesn't support importing multiple files matching a glob pattern, but there is an open issue to implement this feature, ...
Read more >
How to use Glob() function to find files recursively in Python?
In Python, the glob module is used to retrieve files/pathnames matching a specified pattern. The pattern rules of glob follow standard Unix path ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found