• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

yuicompressor

New Here ,
Nov 04, 2019 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

450

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
community guidelines
Participant ,
Nov 06, 2019 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

Votes

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
community guidelines
New Here ,
Nov 07, 2019 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?

Votes

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
community guidelines
New Here ,
Nov 07, 2019 Nov 07, 2019

Copy link to clipboard

Copied

LATEST

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')

Votes

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
community guidelines
Resources
Documentation