Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (25 sloc) 1.06 kb
namespace :js do
desc "Compile the JS for Rails apps without Asset Pipeline"
task :compile do
require 'sprockets'
require 'uglifier'
require 'fileutils'
root_dir = File.expand_path(File.join("..", ".."), __FILE__)
js_dir = File.join(root_dir, "app", "assets", "javascripts", "active_admin")
generated_file = File.join(root_dir, 'lib', 'generators', 'active_admin', 'assets', 'templates', '3.0', 'active_admin.js')
# The base.js file requires jquery. We don't need jquery to
# compile the assets, however Sprockets will try to look it up
# and raise an exception. Insteaad, we move the file out of the directory
# then put it back after we compile.
base_js = File.join(js_dir, "base.js")
tmp_base_js = File.join(root_dir, "base.js") base_js, tmp_base_js
env =
env.js_compressor =
env.append_path js_dir generated_file, "w+" do |f|
f << env["application"]
end tmp_base_js, base_js
Jump to Line
Something went wrong with that request. Please try again.