SourceForge.net Logo jsSplitter version 1.2

GUI

Description

Concatenates a .js file, or a series of .js files, to a single file . The destination file will be created if it does not exist.
The file, which specify files are to be concatenated, compression and targetfile,
will saved as targetfilename.cnct in the same directory .

Execution of GUI

On Windows simply dubbelclick the file jssplitter.jar.
NOTE:
On WindowsXP with Java 1.4.0.x use: java -Dsun.java2d.noddraw=true -jar jssplitter.jar
(avoid bug with java2d)

For all platforms:
From a commandshell run command: java -jar jssplitter.jar


Ant Task

Description

Concatenates a .js file, or a series of .js files, to a single file . The destination file will be created if it does not exist.

note:
Copy the jssplitter jar file into Ant's library directory ($ANT_HOME/lib)

FileSets and/or FileLists are used to select which files are to be concatenated. There is no singular 'file' attribute to specify a single file to cat -- a fileset or filelist must also be used in these cases.

Parameters

Attribute Description Required
targetfile The destination file(.js or .cnct file) for the concatenated stream . Yes
compress Specifies the "compression" for the output file. If "compress=false" files files are to be concatenated as is. Defaults is true. No

Parameters specified as nested elements

fileset

FileSets are used to select files to be concatenated. Note that the order in which the files selected from a fileset are concatenated is not guaranteed. If this is an issue, use multiple filesets or consider using filelists.

filelist

FileLists are used to select files to be concatenated. The file ordering in the files attribute will be the same order in which the files are concatenated.

Examples

<taskdef name="jscnct" classname="org.jresearch.ant.jssplitter.JSConcatTask"/>

Process a .cnct file:

  <jscnct targetfile="${docbook.dir}/test.cnct" />
 
      

Concatenate a series of files, overwriting if the destination file exists:

  <jscnct targetfile="${docbook.dir}/test.js">
    <filelist dir="${docbook.dir}/sections" 
         files="file1.js,file2.js" />
    <fileset dir="${docbook.dir}" 
         includes="sections/*.xml" 
         excludes="file3.js,file4.js" />
  </jscnct>
      

Process a .cnct file , with adding a series of files:

  <jscnct targetfile="${docbook.dir}/test.cnct">
    <filelist dir="${docbook.dir}/sections" 
         files="file1.js,file2.js" />
    <fileset dir="${docbook.dir}" 
         includes="sections/*.xml" 
         excludes="file3.js,file4.js" />
  </jscnct>
      

JSP Custom Tag

Description

Compress a javascript code by removing comments,blank spaces,linefeeds .

Example

<%@ taglib uri="/WEB-INF/lib/jssplitter.jar" prefix="jr" %>
<script><jr:jssweeper>
//***************************************************************************************
var defaultFunction = "";
 
// cs - abbreviation from "change status" - changes status of window
function cs(newStatus) {
    window.status = newStatus;
    return true;
}

// returns absolute position of an obj (summarizes offset(Top|Left) values)
// pos must have value "Top" or "Left"
function getAbsPos(obj, pos) {
	var absPos = 0;
	if (!obj) { return null; }
	while (obj.tagName != "BODY") {
		absPos += (pos == "Left" ? obj.offsetLeft : obj.offsetTop);
		obj = obj.offsetParent;
	}
	return absPos;
}

</jr:jssweeper></script>

Copyright © 2003 jresearch.org All Rights Reserved.