JSMin Plugin


I think there is a bug in the JSMin plugin. Whenever I compress CSS files with @media queries included, the JSMin java appears to remove spaces that are necessary in order for the browsers to display them correctly.

For example:

@media all and (min-width: 601px) and (max-width: 1000px) {



@media all and(min-width: 601px) and(max-width: 1000px) {}

Notice the and( in the compressed version.

There is a necessary space in order for it to render correctly.

I was able to fix this quickly by doing a replace in the JSMin.cfc right before the file is written starting at line 245

//@media query fix
var sbString = sb.toString();
sbString = replacenocase(sbString,‘and(’,‘and (’,‘all’);

// Create concatenated file according to content.
tempFileName = hash(sbString, “MD5”) & “.” & listLast(compressedFiles[1],".");

//write out buffer
fileWrite(instance.cacheDiskLocation & “/” & tempFileName, trim( sbString ));
returnAsset = tempFileName;

Jeremy R. DeYoung


Jeremy can you post more samples on media queries please so I can add them to my test cases for the compiler.


Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Here is a whole bunch of examples http://mediaqueri.es/ - I would think you could take one of the examples and run it against the JSMin.

or do you want me to build a template so you can test against?

Jeremy R. DeYoung