Java Compiler for Less CSS?
LESS Engine wraps the javascript compiler in a straight-forward Java interface.
I haven't used lesscss-java, so I can't comment on relative quality, but in the small tasks I've needed, I've had no complaints with Less Engine.
On the fly LESS compiler for java web app?
I think what you are looking for is a Servlet Filter. I was not aware of an off the shelf one that does LESS compiling and would have started to make one using lesscss-java, but now I can see there is a larger project called Web Resource Optimizer for Java - wro4j with server side LESS support.
How to compile LESS into CSS when files are saved in Eclipse
There are a lot of Java Less compiler (see Java Compiler for Less CSS?), so you can execute one of them by your build tool (e.g. Ant - maybe you need to write a simple Java application, which use the chosen compiler).
If you use Maven (or can switch to it) to project management, then you can use one of lesscss-maven-plugin:
- biz.gabrys.maven.plugins:lesscss-maven-plugin
- org.lesscss:lesscss-maven-plugin
- see more...
Using Less css framework in production
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
What is the recommended approach for compiling LESS files in a Spring Boot web app?
You're asking about the compilation, however, Spring boot is a runtime framework.
I understand that you should compile *.less files into *.css files during the build and then just package the CSS files into spring boot application and make the application serve the static content.
Another option is not to pack the static files into the application but place them somewhere else (here the list of options will vary from some webserver like apache or Nginx to S3 bucket or even CDN) so that the java server won't deal with the static content and instead will totally concentrate on backend processing.
So, given maven is a build tool of your choice and you want to use maven to compile less into CSS, you should look for plugins doing this.
Quick googling shows This plugin (disclaimer - I've never used it by myself).
Now in order to make spring boot serving your static content, this question has been already answered in SO Here
Basically, you should place the code into some pre-defined directory in build time and you're good to go.
Related Topics
Singleton Class with Several Different Classloaders
Scanner Doesn't See After Space
Different War Files, Shared Resources
Preemptive Basic Auth with Httpurlconnection
Get Filepath and Filename of Selected Gallery Image in Android
How to Get Current Location in Googlemap Using Fusedlocationproviderclient
Deserializing Generic Types with Gson
How to Make a Jtable Non-Editable
Getting Strange Output When Printing Result of a String Comparison
Selenium Webdriver - Getcssvalue() Method
How to Change a Bitmap's Opacity
Onclick Event Is Not Triggering | Android
Inside Onclicklistener I Cannot Access a Lot of Things - How to Approach