How to configure
The best way to set up JSCL is to put all your config options into a properties file, then you can use that file from the command line, maven, servlets, IDE, or any other method. Download a copy of the base js-class-loader.properties file and have a look at the comments in there for more info too.
These options are also all available on the command line, use
java -jar js-class-loader-1.x.x.jar --helpto see the options.
Available options
- basePath
This is the directory that the bundle file path and other paths will be relative to. It defaults to the current working directory.
- sourcePaths
This is a list of paths or wildcards that tells JS-Class-Loader the locations of each of your source trees. For the simplest project this might just be a single folder, and for the most complex it might be a set of modules each with it's own source tree and then other locations for third party libraries. Here are some examples:
sourcePaths=js
- a single source tree based in the folder called jssourcePaths=js/src/*,js/lib
- each folder injs/src
is the base of a a source tree andjs/lib
is also a source tree.sourcePaths=js/lib,js/modules/*/src,addons/*
each folder in modules has asrc
folder which is the base of a source tree,js/lib
is the base of a source tree and each folder inaddons
is a source tree.
- bundleFile
File to write the bundle to, if this isn't set then print to stdout.
- sourceMapFile
File to write the source map to.
- watchFiles
Set this to true to run the bundler in watcher mode, it will bundle files then listen for file and folder changes to bundle again.
- seedClasses
Tells JS-Class-Loader where to start scanning from. These classes will always be included along with their dependency tree. This should be a comma separated list of the class or classes that are the entry point of the application, in namespace format, such as
com.example.myapp.MyApplication,com.examle.myapp.AlternateApp
. - seedFiles
Some apps define which javascript classes to run in XML or other config file formats, this config option tells JS-Class-Loader to parse those files for classnames and use those classes to start the dependency trees. You can use this alongside seedClasses, seedClasses can define classes that must always be loaded and this option can then add any dynamic classes that are defined in config.
- list
(command line only) list the classes that would appear in the bundle
- config
Set the path of a config properties file to use. This can be used from the command line too.
- scriptTagsFile
This option tells JS-Class-Loader to also generate an html snippet with script tag entries for each class in the bundle. The script tags file can then be included in a site in development mode to allow the developer to see source at the correct line.
- graphFile
JS-Class-Loader can generate a GraphViz format DOT file of all classes and their dependencies. It is usually a bit too busy to be really useful but future work on groupings and visualisers may make this more useful for large projects.