[JSMin-3.0]

Hi Luis,

I recently downloaded the JSMin plugin from ForgeBox with the intention of using it to compile LESS files into CSS at runtime in my application. The code all works but the compiled CSS output uses “\n” everywhere there was a line break in the source. This makes me think it is supposed to be consumed by JavaScript as the final step to get it to work. I was under the impression that the compiler would produce syntactically correct CSS that would be linked in the HTML source and work on the page but this does not appear to be the case. Do you have any insight into the piece I am missing?

Thanks in advance,
Micah

I guess I don’t understand your question Micah. Are you mixing css with js in the same line. What are you using?

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

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’s the source file “_candidate.less” written with LESS:

`
@baseGrey: #888;

footer {
padding: 2% 25% 6% 25%;
background-color: lighten(@baseGrey, 30%);
}
`

Here’s how I am including the file in my layout:

#getMyPlugin("JSMin").minify("#event.getModuleRoot()#/includes/styles/_candidate.less")#

Here’s the contents of the compiled “_candidate.css” file the plugin produced:

footer {\n padding: 2% 25% 6% 25%;\n background-color: #d4d4d4;\n}\n

This output is syntactically invalid CSS due to the inclusion of the “\n”. It seems like the CSS is being minified as JS instead of CSS. I expect an output along these lines:

`
footer{padding:2% 25% 6% 25%;background-color:#d4d4d4;}

`

Does that clarify?

Hi Micah.

Something must be wrong as I get this:

footer{padding:2% 25% 6% 25%;background-color:#d4d4d4;}

I did exactly what you did:

#getMyPlugin(“JSMin”).minify(“includes/css/candidate.less”)#

I am even committing this as part of the sample test suite. Anyways, I am updating the version as I am adding a concurrency check right now. But I cannot reproduce your issue.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

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

Hi Luis,

I am running ACF 9 and have a custom version of Java installed - 1.6.0_43. Could it be an issue with the .jar file used to compile the LESS code?

-Micah

I am not sure micah, try the compileLess() methods directly from the plugin.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

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

Hi Luis,

I get the same output when calling the “compileLess()” method:

footer {\n padding: 2% 25% 6% 25%;\n background-color: #d4d4d4;\n}\n

What JVM version is your CFML engine using when you run the code?

Thanks,
Micah

I have tried 1.6 and 1.7

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

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

I am using JVM 1.6.0_43 with CF 9.0.1 and Hot Fix 4 applied and still no luck. I am going to give up for now and may revisit later. Thanks for your help!

Have you tried with another engine? Just curious.

I just ran the same code in DevBox on the Railo engine and it works as expected. It is very strange that it would add the “\n” when running it through ACF…

Ok, I tried it in CF 9.0.1
footer{padding:2% 25% 6% 25%;background-color:#d4d4d4;}

CF 10
footer{padding:2% 25% 6% 25%;background-color:#d4d4d4;}

Not sure what’s going on in your setup.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

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

Wow, that’s very strange. What JVM did you use with ACF 9.0.1 and 10?

1.6 and 1.7

Can anybody else report this?

Can both of you supply the exact test code you’ve been trying with? Perhaps one is using cfdump or something that is escaping the string upon output.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Finally figured it out! I am using the HTMLCompressor module and when it is removed, the “\n” characters disappear from the LESS output. I tried turning off some of the module settings but it seems to be built into the basic HTML compression.