just-boris / less-plugin-glob

Globbing support for LESS
MIT License
70 stars 12 forks source link

Globbing Not Functioning #4

Closed SpencerCarstens closed 9 years ago

SpencerCarstens commented 9 years ago

I can't get your plugin to work... I assume I'm doing something wrong.

Has anyone else gotten it to work?

Not getting any errors... just no output when I try to use globbing.

gulp.task( 'styles', () => {
  return gulp.src( [ 'app/styles/main.less' ] )
    .pipe( $.less( {
      plugins: [ require( 'less-plugin-glob' ) ],
    } ) )
    .pipe( gulp.dest( 'dist/styles' ) );
} );
// main.less
// Each line below is tried on it's own of course.
@import "app/module/waffle.less"; // Works
@import "app/module/**"; // Does not work.
@import "app/module/**/*"; // Does not work.
@import "app/module/**/*.less"; // Does not work.
iamfrontender commented 9 years ago

I just met exactly the same behaviour. Also noticed that less won't add rules from globbed files if they're empty.

sonicparke commented 9 years ago

I'm getting the same here as well.

just-boris commented 9 years ago

Well, so many people encountered that issue. But I have the same setup and it is work well

just-boris commented 9 years ago

Fine, got it. Why are you imports declared from the app root? You should import relatively to this file.

andyblount commented 9 years ago

Had the same problem but as Boris says if you import relative to the file it works.

Is is possible to add functionality to make it work from the app root as well?

just-boris commented 9 years ago

Found that less implicitly adds extra path to search files here

if (!isAbsoluteFilename && paths.indexOf('.') === -1) { 
  paths.push('.'); 
}

I can't reuse this piece of code, only copy that to my plugin. I'll try to do it

just-boris commented 9 years ago

Seems to be fixed in my little example. Please try to test current master in your projects, and if it is fine, I will make a release