Git Product home page Git Product logo

Comments (13)

just-boris avatar just-boris commented on September 25, 2024

I am using this with webpack and it works fine for me. Could you please provide more information about your webpack setup?

from less-plugin-glob.

Auxx avatar Auxx commented on September 25, 2024

You can check my current setup here https://github.com/Auxx/angular2-ts-boilerplate/tree/glob (angular2-ts-boilerplate project, branch "glob").

from less-plugin-glob.

just-boris avatar just-boris commented on September 25, 2024

Well, there is nothing to do on our side, it is only issues with Webpack integration. In your example you should add option root=true for less-loader:

-{'test': /\.less$/, 'loader': extractTextPlugin.extract('style', 'css!less')},
+{'test': /\.less$/, 'loader': extractTextPlugin.extract('style', 'css!less?root=true')},

Otherwise every import will be prefixed with ./ and your import will be broken.

Also you should add more asterisks to glob expression to look for files in component folders

-@import "../app/**";
+@import "../app/**/**";

from less-plugin-glob.

Auxx avatar Auxx commented on September 25, 2024

Well, that didn't help at all, sadly. I'm still getting the same error.

from less-plugin-glob.

just-boris avatar just-boris commented on September 25, 2024

The same setup works for me. Let's check the dependencies. I have:

I cleaned up the node_modules folder, then npm install && gulp build

from less-plugin-glob.

Auxx avatar Auxx commented on September 25, 2024

OK, I think I know what is the root of the problem. I'm using Windows and path separator is "" on Windows and it should be escaped or changed to "/". Generated imports look this way right now:

@import "C:\dev-x\angular2-ts-boilerplate\src\app\app.component.less";
@import "C:\dev-x\angular2-ts-boilerplate\src\app\hello\hello.component.less";

from less-plugin-glob.

just-boris avatar just-boris commented on September 25, 2024

That makes sense.
I'll find a windows image and will check it again.

from less-plugin-glob.

Auxx avatar Auxx commented on September 25, 2024

I might make a fix for that this evening after work.

from less-plugin-glob.

Auxx avatar Auxx commented on September 25, 2024

After some investigation I've found out that the issue is in LESS compiler - unless the string starts with a slash, it is always prepended with "./". I did not manage to find the offending piece of code yet, but it looks like your plugin is OK. Issue can be closed now, but I will continue my journey...

from less-plugin-glob.

just-boris avatar just-boris commented on September 25, 2024

Ok, I will be considering the issue as on hold. If you file related issue somewhere else, link it here, I'd like to track.

from less-plugin-glob.

Auxx avatar Auxx commented on September 25, 2024

A bug was found in webpack/loader-utils after many hours of debugging :) An issue with a bug description and a link to pull request with a fix is here.

@hannabasha check it out. If you need this fix before it goes to the main line if loader-utils, you can replace the library with my version inside your node_modules. Make sure to to update everything properly once the library is updated officially.

from less-plugin-glob.

hannabasha avatar hannabasha commented on September 25, 2024

@Auxx thank you! I will close my opened issue then!

from less-plugin-glob.

bostrom avatar bostrom commented on September 25, 2024

Hi, I have the same problem in my webpack setup even though I'm on OS X and have added the root=true to the less configuration. I have a sample repository here with the less-glob tag pointing to the problematic setup https://github.com/bostrom/webpack-demo/tree/less-glob.

Any ideas on this one?

from less-plugin-glob.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.