Is there something like Compass but for javascript? I'm interested in a tool where it will take the main js files and all the other files that are included and press it to a new js file with all the code on 1 line as soon as you save your changes in whatever file you are working.
Is there something like Compass but for javascript? I'm interested in a tool where it will take the main js files and all the other files that are included and press it to a new js file with all the code on 1 line as soon as you save your changes in whatever file you are working.
Share Improve this question edited Aug 5, 2012 at 8:47 AlfonsoML 12.7k2 gold badges49 silver badges55 bronze badges asked Aug 31, 2011 at 8:08 ChristopheChristophe 4,8285 gold badges45 silver badges84 bronze badges4 Answers
Reset to default 2Compass includes that functionality. For instance, I use bootstrap.js
for one of my projects. I watch the file with Compass and have it minify the file into bootstrap-ck.js
, which is the file I refer to in my production code.
I've attached an image which should show you the details. Notice that you can do imports just as you would with Sass or Less.
You'll also be able to have it check the code through JSHint or JSLint. If you're having issues, you can check the Compass documentation or open your config.rb
file to see the Compass details for that particular project.
Hope that helps.
You're looking for a Javascript minifier. There are a whole bunch of them to choose from. Try this one or this one, or google for "javascript minifier" for more.
Note that in addition to simply putting all the code on one line, these tools also rename your variables and functions to shorter names, and do a few other tricks to make the code as tiny as possible. The end result should be functionally identical to your original code, but it won't be exactly the same as the code you wrote.
You have a tool from yahoo
http://developer.yahoo./yui/pressor/
And you also have a tool (if you're working with ) for this pressor
http://yuipressor.codeplex./
Another remendation would be UglifyJS