-
Notifications
You must be signed in to change notification settings - Fork 27
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
Caching is incompatible with @imports #15
Comments
Hmm... are your imported files not run through less lint as well? Wouldn't they fail upstream or downstream? |
Our architecture is that we have one main less files with a bunch of partials that get imported. It's not practical to lint the partials themselves because they use variables from a separate partial, and cause false positives about missing variables. So we only lint the main file, and add the partials directory to the |
So, essentially we'd have to change the cache key of the file from just that files contents to its contents and any imports contents. I'll investigate and see what the impact is on speed. |
This is proving to be tricky, I can build a naive solution that just parses the less into css every time and then uses the css as a cache key but that doesn't really improve performance as much as now because the less parsing is what we're trying to avoid. Ideally, I think we'd do a regex match for import statements, grab their file contents (keep the file contents around for later lookups from other less that import it), add all the contents together as hash key. The problems I foresee with this are relative path resolution vs passing in less options with import lookup paths. I'm going to punt for now and probably push up something that parses every time since there is a risk of false positive cache hits right now. |
Your idea sounds good, but I can imagine how it would be tricky. To start with, you'd have to recursively regex match all What about this: Read the less |
@cvn just to update on this, plan to go with your strategy of hashing the |
The intermediate fix has landed in 0.19.0. |
Very cool. Thanks, @jgable |
When
cache: true
is set andimports: []
is defined,grunt-lesslint
ignores changes to @imported files. I tested this by inserting a linting error into an imported less file. Unless I change the parent file, this error is not caught during linting.The text was updated successfully, but these errors were encountered: