Easiest way to pack / reduce multiple javascript files?

I am looking for a website / program that will allow me to select multiple javascript files and display their miniature versions in the order in which they were selected. (For example, the code of the first selected files at the top, the last files at the end). Any ideas?

+5
source share
4 answers

the Closure compiler (and I suspect most large JS compressors) already allow this.

From java -jar closurecompiler.jar --help

- js VAL
: javascript file name. You can specify several

+5
source

Update:

PHP script, : D https://github.com/mario-deluna/packtacular


Ed Eliot (www.ejeliot.com) createt PHP JavaScript. script Jsmin , .

foreach ($aFiles as $sFile) {
    $aLastModifieds[] = filemtime("$sDocRoot/$sFile");
    $sCode .= file_get_contents("$sDocRoot/$sFile");
}

foreach ($aFiles as $sFile) {
    $aLastModifieds[] = filemtime("$sDocRoot/$sFile");
    $sCode .= JSMin::minify(file_get_contents("$sDocRoot/$sFile"));
}
+2

YUI compressor supports this too (for both CSS JS files, by the way)

+1
source

You can merge files into one file ( cat [files] >or type [files] >) before reducing

0
source

All Articles