3

I have a project which consist of a lot of static HTML and js files. I need a build tool that can concatenate and minify them.

I saw this great screencast that explains how to do it with ant and YUI. The only thing I'm missing is after the minified version is created , how can i replace references to the JS/CSS files in the HTML, so it will reference the new minified version?

Is there a better/easier tool for this (not GPL/LGPL license)?

3
  • 1
    Why not GPL/LGPL? You probably won't need to modify something like this, so there is no viral licensing to worry about. Commented Aug 16, 2012 at 20:14
  • I work at a large company that forbids the use of that license. Commented Aug 16, 2012 at 20:26
  • 1
    @ftom2 don't tell them that by merely asking this question on the Internet you're using vast quantities of GPL software :-) Commented Aug 16, 2012 at 20:28

2 Answers 2

5

Grunt is pretty good, and supports most of those things. This plugin will re-write your CSS link tags, though normally (and for JS) you'd just write the link/script tags to point straight to the minified version anyway, and continually have it build your files.

Sign up to request clarification or add additional context in comments.

3 Comments

you'd just write the link/script tags to point straight to the minified version anyway - not sure i understand, I have many css/js files and i want them concatenated to just one file. how can reference it before it exists?
Because you never view the file you're editing - you only ever view the built version of your site, where the concatenated files do exist. Grunt can run continuously to keep the files in sync while you work
So there are also 2 HTML versions?
0

You can try minify JS and CSS. Minify JS can make 1 JS file merging multiple JS file and same for CSS.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.