-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Imports are not updated when recompiling via the same (?) less object #3185
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
Comments
Sounds similar to gulp-community/gulp-less#283. |
@seven-phases-max yes,use the same Less object to compile each update. |
So the quick workaround (until the bug is fied) in your case wil be in: require('less').render(indexContent,options,(err,result)=>{
console.log(result.css)
}); |
Yes, it seems the issue lies in this commit where the calltree is manipulated based on arguments a48c24c#diff-a6b31db4e862654ae597161e441689bb |
Hmm, honestly there I can't see anything that could affect imports... |
In Node environment, manual clear less compile cached file:
|
Thanks @tiodot it seems to be working so far... But hope we'll get a "cleaner" way soon! |
It might have something to do with these lines added for 3.0. https://github.com/less/less.js/blob/master/lib/less/tree/mixin-definition.js#L9 Try removing the specific if/else to just the else statement and see if the problem still happens. If it doesn't, this optimization may need to be removed. However, what would be more ideal is clearing the file manager or any internal cache per new parse/render call. |
Just checking if there are any updates for this issue? |
Just gave another try a few hours ago and it seemed to be working fine (without patch). Anyone else?
|
I have the same issue descibed by @xinglie upgrading from [email protected]. The workaround provided by @tiodot did not seem to work for me (tried: [email protected] and [email protected]). |
Also affected with this :( |
Less 3.x has a bug that prevents the correct CSS from being generated when the `less` object in node is reused and the entry point hasn't changed (CSS changes only exist in `@import`ed files). The first compile works as expected, but subsequent compiles are broken. This is causing issues with our build pipeline when updating styles and the development server is running. Currently, you have to restart the development server to see the updated styles. See less/less.js#3185
Hi, though I am not sure what I did differently the workaround @tiodot provided DOES work for me now! |
Thanks @tiodot |
@tiodot @hawkerboy7 @TigersWay Does this branch resolve the issue? If so, I'll make a PR - please check this out - https://github.com/matthew-dean/less.js/commits/cache-modified |
Just did checks in 2 clearly different projects, commenting out @tiodot great patch inside package.json, and it seems to be working perfectly!!
|
@matthew-dean works for me! |
@matthew-dean Yes it has resolved the issue! PR to the rescue!! :) |
@tiodot @hawkerboy7 @TigersWay Cool, the nice thing is, you should get slightly faster Less compiling with a warm cache (a 3.x feature), so it's preferable to have it fixed; otherwise I would have suggested taking it out. Will do a PR. |
bug report
I write a compile tool for my project, it depend less.
my project style folder and files likes
and
index.less
content isI use less api to compile the less files like
when i change
_utils.less
content , the above code will automatically executebut since 3.0.x , when i change
_utils.less
content ,theresult.css
is the first time result, whatever change how many times.but 2.7.x is ok, when i change
_utils.less
content ,theresult.css
also changed.The text was updated successfully, but these errors were encountered: