I know that there are ways to dynamically load it into the page, but if I want to compress my code so it loads even faster, how do I do it?
This project can do quite a lot, but the basics are this:
I use Justin Etheredge's SquishIt project. It is awesome! For asp.net only however.
- It supports LESS
- I believe it supports Google Closure
- It is ridiculously easy to use.
Read the intro to squishit blog post.
Here's some sample code that will render a single
<script> tag and a single
<link> tag. Both of which will point to a combined and minified JS/CSS file.
- Yahoo YUI Compressor
- Microsoft AJAX Minifier
All are very powerful -- you can find comparisons of them quite easily. All are command line tools, so they can be easily integrated into your run automatically when you build or publish your website.
You can also find many websites that run these tool for you, which will save you the time of having to install/configure. This also helps if you aren't familiar with using command line tools.
Personally, I've always used YUI Compressor.
This one uses YUI compressor algorithm: