Closed (fixed)
Project:
Less CSS Preprocessor
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
26 May 2011 at 00:47 UTC
Updated:
25 Jul 2013 at 19:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
corey.aufang commentedOnly problem with checking modified time is that it only checks the file added with drupal_add_css or from the info file.
This precludes rebuilding when changes are made in a @import'ed .less file in another .less file.
Comment #2
patrickharris commentedTrue. But you could always check each file for @import files. There's such a huge overhead involved in rebuilding on every page, otherwise.
Something along the lines of ...
Comment #3
jox commentedI was thinking the same and wrote some code that does the following:
Caching the lists of imported files reduces even more overhead.
This is in total much less overhead than regenerating all less files on each request.
A patch against 7.x-2.x-dev is attached.
Comment #4
jox commentedSome additional notes to the patch:
Comment #5
jox commentedOne more thing needs to be mentioned. There is a bug in core that also needs review #1198904: drupal_load_stylesheet() fails to load @import files in different directories.
The bug might affect css files that import other files that are not in the same directory.
Comment #6
patrickharris commented@jox Your patch works well for me - thanks!!
I guess, being a bit anal here, it seems wrong to have a lot of @import files being loaded on each page load (via variable) if they aren't being used - so perhaps you could delete the 'less_imported_files' variable when someone turns off the developer mode?
Comment #7
jox commented@patrickharris:
I'm glad it works for you.
I'm not sure if I understand you correctly. What I can say is:
The 'less_imported_files' variable does only store file names (with path). But not the contents of the files.
The variable will never be loaded when developer mode is not set.
The variable will be deleted on less cache flush.
But I agree it would be good to delete the variable when developer mode is turned off, just to clean up.
So here is a new patch with the following changes.
Comment #8
patrickharris commented@jox - excellent! I'll try the new patch & report back. Thanks for that.
Re the variable - it is loaded into global $conf on every page request. It's a very small thing, but best to delete it when it's not needed I think.
Comment #9
jox commented@patrickharris: Uh, now I get it. You are of course totally right. All the variables are being loaded on every request (into $conf), even if they are not accessed. I didn't consider that. So thanks for the hint.
Comment #10
patrickharris commentedI hope this patch gets committed!
Comment #11
ambient.impactSubscribing. Would also love to see this committed.
Comment #12
bsztreha commentedSubscribe! Good idea
(i think about other idea: regeneration of files depend on logged USER - designer)
Comment #13
patrickharris commentedI'm not sure why this has been left neglected? I'd love to see this committed. Is there any reason holding it back? It seems to work fine for me.
Comment #14
xen commentedBecause it's been suggested and implemented before, but the maintainer didn't like it: #789410: Cache cleaning
Comment #15
patrickharris commentedIt's a great pity. I totally agree with your thoughts in that thread.
Comment #16
corey.aufang commentedI'm working on a solution that will incorporate the fixes from #1198904: drupal_load_stylesheet() fails to load @import files in different directories as well as checking mod times of nested files. I think that if this module were to include its own version of drupal_load_stylesheet that it make the module more stable.
#1198904 is quite important here since you are more likely to have libraries of LESS and therefore include more files through @import.
It also might be time to work in #988552: add import paths since this is related to having correct paths when navigating through file systems.
Comment #17
jox commented@corey.aufang: Sounds good. I only think that including an own version of drupal_load_stylesheet is not a good long term solution. It makes sense for now until it is fixed in core. But then it would create redundant code and also violate Drupals policy of avoiding duplicate efforts.
Otherwise you could copy even more core code to your module to make it even more stable. Not a good approach.
It would be different of course if we'd need a drupal_load_stylesheet with different functionality.
Comment #18
corey.aufang commentedThere is a solution for this issue by using lessphp v0.3.7+ along with some code changes I'm making to the module.
This will allow for filemtime checking, including all children, and does it all without making our own version of drupal_load_stylesheet().
Might have to require that version for the module to work. Or a major version bump.
Comment #19
corey.aufang commentedPlease check out the latest beta.
If you are still finding problems, please retag this issue with the new version as all future development for D7 will be on the 7.x-3.x branch.
Comment #20
corey.aufang commentedMigrating to task as this functionality is now included in the 7.x-3.x version.
Check out the latest 7.x-3.x-dev version to test.
Comment #21
corey.aufang commentedThis should be resolved in 7.x-3.0.