Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Add cfjavascript and cfstylesheet tags to railo server. Compile and compress js and css resources.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 demo
Octocat-spinner-32 extension
Octocat-spinner-32 lib
Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 build.xml
Octocat-spinner-32 config.template.xml
Octocat-spinner-32 project.properties
Octocat-spinner-32 reload.cfm
Octocat-spinner-32 version.xml
README.md

CFJAVSCRIPT

Attributes

Name Type Required Default Description
src String or [String] true A single ( or an array of ) relative path that point to the js files to be compressed. Path must be relative and inside the context web root.
path String false /_cfjavascript A relative path that will be used to store the compressed file and to serve it to the web server. If not provided a directory called /_cfjavascript will be created and used.
filename String false If provided give the name to the js generated file.
Filename must be unique in the choosen 'path' ( or per project if a single path is used all along the project ). Tag will check if a file exists when decide if generated a new compression or serving a cached copy. If not provided an hash is used.
cache boolean false true If true the compression is done once for any different sets or src paths. From this point the saved file will be served to the web server.
Set this to false if you want to force the tag to generate a new compressed file ( you can obtain the same result adding '_cfjavascript_nocache' to the url ).
debug boolean false false If true the tag will output the files as originally are. The src array order is respected.
You can obtain the same result adding '_cfjavascript_debug' to the url.
This is incredibly usefull for js debugging.
linebreak Numeric false 800 The linebreak option is used in that case to split long lines after a specific column.
It can also be used to make the code more readable, easier to debug (especially with the MS Script Debugger) Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS.
munge boolean false false If true minify and also obfuscate local symbols.
preserveAllSemiColons boolean false false Preserve unnecessary semicolons (such as right before a '}')
disableOptimizations boolean false true Disable all the built-in micro optimizations.

Examples

  • Default - compress and concatenate 2 js files.

    <cfset src = ['RailoAjax.js','jquery.js'] /><br/>
    <cfjavascript src="#src#" />
    
  • Choose a filename and a custom path.

    <cfset src = ['RailoAjax.js','jquery.js'] /><br/>
    <cfjavascript src="#src#" path="/cfjs/test/jscompressed" filename="myJs"/>
    
  • Debug

    Same as the default but this time append ?_cfjavascript_debug to url
    
  • Force Compression ( no cache )

    Same as the default but this time append ?_cfjavascript_nocache to url and files will be recompressed.
    
  • Munge

    <cfset src = ['RailoAjax.js','jquery.js'] /><br/>
    <fjavascript src="#src#" path="/cfjs/test/jscompressed" filename="myJs_Munge" munge="true"/>
    

CFSTYLESHEET

Attributes

Name Type Required Default Description
src String or [String] true A single ( or an array of ) relative path that point to the css files to be compressed. Path must be relative and inside the context web root.
path String false /_cfstylesheet A relative path that will be used to store the compressed file and to serve it to the web server. Css files need to point to external resources as images.... The path should be the same of the original files so to be sure do not break css dependencies
filename String false If provided give the name to the js generated file.
Filename must be unique in the choosen 'path' ( or per project if a single path is used all along the project ). Tag will check if a file exists when decide if generated a new compression or serving a cached copy. If not provided an hash is used.
cache boolean false true If true the compression is done once for any different sets or src paths. From this point the saved file will be served to the web server.
Set this to false if you want to force the tag to generate a new compressed file ( you can obtain the same result adding '_cfjavascript_nocache' to the url ).
debug boolean false false If true the tag will output the files as originally are. The src array order is respected.
You can obtain the same result adding '_cfjavascript_debug' to the url.
This is incredibly usefull for js debugging.
linebreak Numeric false 800 The linebreak option is used in that case to split long lines after a specific column.
It can also be used to make the code more readable, easier to debug (especially with the MS Script Debugger) Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS.

Examples

  • Default - compress and concatenate.

    <cfset src = ['core.css','skin.css']  />
    <cfstylesheet src="#src#" />
    
  • Choose a filename and a custom path.

    <cfset src = ['RailoAjax.js','jquery.js'] /><br/>
    <cfstylesheet src="#src#" path="/demo/cssCompressed" filename="myCss"/>
    
  • Debug

    Same as the default but this time append ?_cfstylesheet_debug
    
  • Force Compression ( no cache )

    Same as the default but this time append ?_cfstylesheet_nocache. Files will be recompressed.
    
  • Linebreak = 0

    <cfset src = ['RailoAjax.js','jquery.js'] /><br/>
    <cfstylesheet src="#src#" path="/demo/cssCompressed" filename="myCss_l0" linebreak="0"/>
    
Something went wrong with that request. Please try again.