Assert Packager plugin
Plugin details
Documentation
ruby script/plugin install http://sbecker.net/shared/plugins/asset_packager/
1. Download and install the plugin:
./script/plugin install http://sbecker.net/shared/plugins/asset_packager
2. Run the rake task "asset:packager:create_yml" to generate the /config/asset_packages.yml file the first time. You will need to reorder files under 'base' so dependencies are loaded in correct order. Feel free to rename or create new file packages.
IMPORTANT: JavaScript files can break once compressed if each statement doesn't end with a semi-colon. The minifier puts multiple statements on one line, so if the semi-colon is missing, the statement may no longer makes sense and cause a syntax error.
Example from a fresh rails app after running the rake task. (Stylesheets is blank because a default rails app has no stylesheets yet.):
javascripts: - base: - prototype - effects - dragdrop - controls - application stylesheets: - base: []
Example with multiple merged files:
javascripts: - base: - prototype - effects - controls - dragdrop - application - secondary: - foo - bar stylesheets: - base: - screen - header - secondary: - foo - bar
3. Run the rake task "asset:packager:build_all" to generate the compressed, merged versions for each package. Whenever you rearrange the yaml file, you'll need to run this task again. Merging and compressing is expensive, so this is something we want to do once, not every time your app starts. Thats why its a rake task.
4. Use the helper functions whenever including these files in your application. See below for examples.
5. Potential warning: css compressor function currently removes CSS comments. This might blow away some CSS hackery. To disable comment removal, comment out /lib/synthesis/asset_package.rb line 176.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, 9 months ago

