Coder Social home page Coder Social logo

Comments (5)

geddski avatar geddski commented on June 2, 2024

Thanks for pointing this out. I've added support that this via the command line. See the updated readme for usage. And yes, CSS folder relative to the project root. I've clarified the docs. Try it out and lemme know if you run into any problems. Thanks!

from lessless.

2m3 avatar 2m3 commented on June 2, 2024

Thanks for looking into this. lessless now generates the complete css file (no additional command line params required), but still throws errors during that process. They look like they are related to @ imports.

My setup is that I have ~5 less files in one folder where main.less @ imports all others. I guess that lessless not only generates main.css (which works just fine) but also tries to separately optimize the other .less files (which will not work as they do not @ import their dependencies). I can actually see not only see main.css generated by lessless but also file1.css and file2.css (which are empty due to the errors).

How can lessless decide that main.less is the file that @ imports all others so there's no need to optimize the others?

Another note: Looks like npm still has 0.2.8 while you've already pushed to 0.2.9.

Thanks again.

from lessless.

geddski avatar geddski commented on June 2, 2024

published latest to npm, thanks for the reminder.

I see what you're talking about. Yeah, lessless scans the directory and compiles ALL LESS files. It does that on purpose so that it works just as well for websites as it does for web apps, letting you split your LESS into smaller sections and load just what you need.

It's probably a best practice to @import your dependencies on all your files. Otherwise later you may be using a random variable/mixin and have no idea where it's coming from, or someone might reuse that same variable/mixin name and mess things up. Explicit imports is probably the way to go.

That said, it wouldn't be hard to have lessless either ignore certain directories, or compile only certain directories. Will have to think on it some more. What would your suggestion be?

from lessless.

2m3 avatar 2m3 commented on June 2, 2024

@importing dependencies on all files didn't feel DRY to me in the first place. However, it actually mirrors the behavior of a node require call or something similar. I guess in my case there's only one or two files all others depend upon (colors and mixins) so that's a valid way to go.

My suggestion would be to only compile less files that are actually replaced in the HTML. That's of course more logic to write but would exactly be what I expected from lessless after reading the docs. I don't need lessless just to compile a bunch of less files. Its value stems from modifying the HTML files as well. The less files referenced in the HTML must be the "entry point" for all other less files in the project.

from lessless.

geddski avatar geddski commented on June 2, 2024

Hey that's a clever idea, I like it. I would probably want it to be optional, as I know of projects that use lessless without the link changing. I've opened issue #4 to track progress on that feature.

from lessless.

Related Issues (5)

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.