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?
Overview. Less (which stands for Leaner Style Sheets) is a backwards-compatible language extension for CSS. This is the official documentation for Less, the language and Less.js, the JavaScript tool that converts your Less styles to CSS styles.
You can download the latest version of less. js from http://lesscss.org/ and copy this file into your working directory.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With