Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Less css framework in production

Few weeks back only, I came to know about LESS CSS. And it is exactly what I was thinking should be available while writing css code.

Now I am very eager to use it and want to apply this in production scenario, but there is a catch. To use LESS CSS, you have two options:
1. Include less.js in your web pages.
2. Precompile LESS files and then use.

First option I can not afford, because for that I need to use less.js of size upto 43 KB. This adda extra load when I am already using Jquery.

Second option looks promising, but the problem is, to code in production you can not compile your LESS every time to test it against changes. It should be seemless experience like what I do when i code CSS directly. I should write LESS and immediately it should reflect on pages.

So can anybody help me in setting up for this kind of workflow?

Any suggestions of other similar frameworks is appreciated.

like image 845
Abhijeet Pawar Avatar asked Mar 03 '12 19:03

Abhijeet Pawar


1 Answers

I use Less-PHP in development: each time I refresh my browser for testing after having modified the main .less file, the .css file is outputted.

Then in production I only have to copy the .css file as usual.

I won't ever use Less.js in production because it'll only work for users that have JS activated, will slow every user both for download times and rendering times when it's not necessary.

EDIT: there are also software that will wait for your LESS file to be modified and saved and will compile it when it happens. Again Less PHP can be setup once per project and will do the same, I prefer not to launch every day a daemon on my system if I can avoid it. I already have a firewall, AV, MSN, Dropbox, jabber client, copypaste utility, integrated SVN and so on running :)
EDIT in 2015: I've been using Prepros 4 for a while or would've used some grunt-based compiler instead. My colleagues've a few bugs with Prepros 5 so I haven't installed it yet (Prepros 5 is now a proprietary software, costs a few bucks. A very good investment imo)

EDIT2: Seems you're using Java. A little googling gives this solution: http://www.asual.com/blog/lesscss/2009/11/05/less-for-java.html

like image 118
FelipeAls Avatar answered Oct 22 '22 07:10

FelipeAls