242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
# File 'lib/snails.rb', line 242
def self.precompile_for(app)
unless app.respond_to?(:assets_public_path)
return puts "#{app.name} doesn't have the Asset module included."
end
puts "Precompiling #{app.name} assets to #{app.assets_public_path}..."
FileUtils.remove_dir(app.assets_public_path.to_s, true)
environment = app.sprockets
manifest = ::Sprockets::Manifest.new(environment.index, app.assets_public_path)
manifest.compile(app.assets_precompile)
if app.assets_remove_digests?
files = `find #{app.assets_public_path}`.split("\n").select { |f| f[/\.(js|css)/] }
remove_digests(files)
end
end
|