Created
August 27, 2010 19:15
-
-
Save paulredmond/553987 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'Sprockets' | |
require 'Jsmin' | |
MINFILE = 'app/webroot/js/build-min.js' | |
CONCATFILE = 'app/webroot/js/concat.js' | |
secretary = Sprockets::Secretary.new( | |
:asset_root => 'app/webroot', | |
:load_path => ['app/webroot/js', 'plugins/*/vendors/js/**', 'app/plugins/*/vendors/js/**'], | |
:source_files => ['app/webroot/js/*.js', 'plugins/*/vendors/js/**/*.js', 'app/plugins/*/vendors/js/**/*.js'], | |
:strip_comments => true | |
) | |
# generate the concatenation object | |
concatenation = secretary.concatenation | |
# write to disk | |
gluedFiles = concatenation.to_s | |
concatenation.save_to(CONCATFILE) | |
# Run through JSMin | |
File.open(MINFILE, 'w') { |file| file.write(JSMin.minify(gluedFiles)) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Plugin paths to js files was updated in CakePHP 1.3. This example is for CakePHP 1.2