I think it would be nice if the module can report the lessphp version number it's using. That will allow developers to look up which less functions can be used and check if the libraries module is loading the library correctly. The status report screen would be a good place, I guess.
Once you have the lessphp include path (just like _less_pre_render() does) you can use this code to get the version string:
preg_match('#lessphp v[0-9\.]+#', file_get_contents($lessphp_include, NULL, NULL, 0, 200), $matches);
$version_string = $matches[0];
// $version_string is now "lessphp v0.3.1"
If you think this feature is worth implementing, I can try to create a real patch (or feel free to implement it yourself if you like :-)).
Comments
Comment #1
marcvangendComment #2
corey.aufang commentedThis is already in the works :)
Comment #3
marcvangendAwesome, thanks Corey. I'll just set this to 'need work' then, even though the work is not visible here. Let me know if I can help.
Comment #4
portulaca+1
Comment #5
attiks commentedI needed this as well, so I've opened an issue at https://github.com/leafo/lessphp/issues/186
Comment #6
marcvangendYes, that would be much nicer than my quick-and-dirty regex.
Comment #7
marcvangendThe issue on github is now fixed and closed; upcoming versions will support a property:
lessc::$VERSION.Comment #8
markus_petrux commentedWould it be possible to use REQUIREMENT_OK instead of REQUIREMENT_WARNING for the entry $requirements['less_version'] in hook_requirements?
Comment #9
corey.aufang commentedIf you're talking about the latest commit that I made, thanks for spotting that.
Comment #10
corey.aufang commentedThis should be resolved in 7.x-2.5.