Skip to content
Advertisement

Minify and join CSS & JS files on linux, server side

In my project, for example, I have this structure:

JavaScript

After changes have been made, I would like to type in command line something like:

JavaScript

which would generate two files:

JavaScript

For the moment I am using less css, which is working on node. I would like to have one script that will do everything, for css as for javascript. Could you please advise the best way to “build” dev-source javascript & css files?

Advertisement

Answer

You can use YUI Compressor. I’m sure it’s also available for Linux. It works from the command line. Read here how it works.

Example:

JavaScript

I’m sure you can setup a simple Bash script that executes two commands, one for CSS and one for JS by using parameters as input.

Advertisement