Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jekyll-less doesn't understand @imports/dependency tree #10

Open
aldeka opened this issue May 27, 2015 · 1 comment
Open

jekyll-less doesn't understand @imports/dependency tree #10

aldeka opened this issue May 27, 2015 · 1 comment

Comments

@aldeka
Copy link

aldeka commented May 27, 2015

Let's say I have two files, main.less and variables.less. As is, jekyll-less will happily compile both into main.css and variables.css. I don't need the latter file, but it's harmless.°

Now I change one of my variables in variables.less. variables.css gets recompiled. main.css, the file I actually care about, does not get updated, however, because jekyll-less doesn't understand that an @import statement means that changes to the imported files mean that this file needs to be recompiled as well. Every time you change an imported file rather than your main LESS file, you have to recompile by hand, which obviates the reason to use jekyll-less at all.

This isn't an obscure problem. It is a common pattern to spin out variables and mixins into helper files. Most notably, Twitter Bootstrap's source does this. But as it stands, you can't use Bootstrap's variables file to customize your Bootstrap colors without setting up a separate non-Jekyll-based watcher-compiler infrastructure.

I see a few ways to fix this.

One would be to write some code that could parse @import statements and recompile accordingly. That would be awesome, but probably difficult to do accurately and quickly.

Another, simpler way would be to pass config arguments to jekyll-less that would allow users to specify a file or files that should always be recompiled if any LESS file is changed. So main.less in the example above, or bootstrap/bootstrap.less in the Bootstrap case. That approach would indeed be dumb as a rock, but it would still be better than having to control-C + up arrow + Enter over and over and over again.

° If you have a more complicated inheritance structure with files included that rely on other previous includes, which is the case with Bootstrap 3 source, you will get a lot of errors logged to the console every time your LESS gets compiled. But it doesn't give up on compiling the files that matter, so the only problem is the noise.

@davkal
Copy link

davkal commented Jun 9, 2015

I created #11 for this. It allows to set an entrypoint file in the _config.yml. Even if another file is changed, less is only called on the entrypoint file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants