This script basically turns .less
code into .css
code. I think it will only cause problems if the user has javascript turned off, but do many people do that?
Any suggestions?
This script basically turns .less
code into .css
code. I think it will only cause problems if the user has javascript turned off, but do many people do that?
Any suggestions?
Just compile the .less
into .css
before putting it into a production environment. That way it will still display to those without JS enabled, and won't suffer the issues @Plynx mentioned.
As for compiling, there are some real-time compilers out there, specifically:
Both compile .less
to .css
on file save, which is awesome, and makes LESS easier to use!
Many people do (I don't have exact numbers, but IIRC less than 4%), but you are under no obligation to provide functionality without javascript. Many of the more advanced sites today do not. It depends on what you are serving and who your audience is.
Of course it's great to provide this functionality if you can. I would be more concerned about the effect less.js will have on your site's load time. If you can't load the CSS until after the javascript, you have to delay rendering until the javascript runs, in order to avoid an unseemly transition from unstyled to styled.
You can have your .less files auto-compile into CSS whenever they are changed by using tools that watch directories.
It really depends on what you're building and who your target audience is. Modern browsers that support HTML5 will cache the generated CSS the first time it loads so if the majority of your visitors will be using modern browsers it's pretty safe.
Other options is making your own less compiler in server and then you can "play" with cache times css results.
You can check libraries as LessPHP in order to do that.