Highlighted

yuicompressor

New Here ,
Nov 04, 2019

Copy link to clipboard

Copied

What is the best to create minified JS and CSS files? 

 

I've done in the past using an IDE and automatically durring the "File Save" process.  However, now Im working with a team where everyone uses a different IDE.

 

My preference is to create some sort of asset manager that uses yuicompressor (https://github.com/yui/yuicompressor) that creates minified files on the fly if they currently are not found on the server.

 

I'd like to call the yuicompressor jar file directly with Coldfusion withouth using cfexecute.  Is this possible?

TOPICS
Advanced techniques

Views

287

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

yuicompressor

New Here ,
Nov 04, 2019

Copy link to clipboard

Copied

What is the best to create minified JS and CSS files? 

 

I've done in the past using an IDE and automatically durring the "File Save" process.  However, now Im working with a team where everyone uses a different IDE.

 

My preference is to create some sort of asset manager that uses yuicompressor (https://github.com/yui/yuicompressor) that creates minified files on the fly if they currently are not found on the server.

 

I'd like to call the yuicompressor jar file directly with Coldfusion withouth using cfexecute.  Is this possible?

TOPICS
Advanced techniques

Views

288

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 04, 2019 0
Participant ,
Nov 06, 2019

Copy link to clipboard

Copied

I saw a working version in the past, but don't have the code at hand. There's one code on the internet: https://www.mitrahsoft.com/index.cfm/blog/minify-js-css-files-using-coldfusion-and-yui-library

I believe I tried to work with createDynamicProxy in the past and it wasn't 100 percent perfect.

 

The thing is, YUI wasn't updated in years and cannot handle many recent JS features: https://github.com/yui/yuicompressor/issues/234

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 06, 2019 0
New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

I actually tried that example already but run into errors I couldnt resolve.  I think YUI is no longer comptabile with the latest version of java as I couldnt get the command line version to work anymore either. 

 

Are there any alternative suggestions for a versatile CSS/JS compressor that doesnt use an online service?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0
zpm007 LATEST
New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

Actually I stand corrected.. the command line works calling yui directly with java.  Below is the problem I got with the example from https://www.mitrahsoft.com/index.cfm/blog/minify-js-css-files-using-coldfusion-and-yui-library.

 

This line here

<cfset compr = createobject( "java", "com.yahoo.platform.yui.compressor.JavaScriptCompressor" ).init( joInput, jErrRep )>

 

Throws Error:

class java.lang.ExceptionInInitializerError cannot be cast to class java.lang.Exception (java.lang.ExceptionInInitializerError and java.lang.Exception are in module java.base of loader 'bootstrap')

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0