2

I want to have both a minified and an expanded version on this site (it's for delivering to another developer, not production). I want to be able to have a JS file running PHP that has a list of expanded files to go through that will create a minified file if necessary from the original expanded file without modifying the expanded file at all.

I have looked at the minify project as a potential library, but from my understanding, that always minifies the files when they are requested. If this is not the case, could you please tell me how to implement it so that I can save the contents appropriately?

I'm imagining what I want to do like this:

$files = Array('filename', 'filename', 'filename');

for($i = 0; $i < count($files); $i++) {
    // does $file[i].js exist?
    // does $file[$i].min.js exist?
    //    if both exist, check if the timestamp of min > js - if it's younger, we need to minify
    //    if min does not exist we need to minify

    // to minify:
    //    get the contents of js, minify it, save it as .min.js
}

I would like to be able to do this with CSS as well, but I can always run two different sass watch consoles, one with expanded and the other with compact if there is not something like this for CSS.

4

0 回答 0