Methods
- A
- C
- N
- P
- W
Attributes
| [RW] | env | |
| [RW] | paths | |
| [RW] | target |
Class Public methods
new(env, target, paths, options = {})
Link
# File actionpack/lib/sprockets/static_compiler.rb, line 7 def initialize(env, target, paths, options = {}) @env = env @target = target @paths = paths @digest = options.key?(:digest) ? options.delete(:digest) : true @manifest = options.key?(:manifest) ? options.delete(:manifest) : true @manifest_path = options.delete(:manifest_path) || target end
Instance Public methods
aliased_path_for(logical_path)
Link
compile()
Link
# File actionpack/lib/sprockets/static_compiler.rb, line 16 def compile manifest = {} env.each_logical_path(paths) do |logical_path| if asset = env.find_asset(logical_path) digest_path = write_asset(asset) manifest[asset.logical_path] = digest_path manifest[aliased_path_for(asset.logical_path)] = digest_path end end write_manifest(manifest) if @manifest end
path_for(asset)
Link
write_asset(asset)
Link
# File actionpack/lib/sprockets/static_compiler.rb, line 35 def write_asset(asset) path_for(asset).tap do |path| filename = File.join(target, path) FileUtils.mkdir_p File.dirname(filename) asset.write_to(filename) asset.write_to("#{filename}.gz") if filename.to_s =~ /\.(css|js)$/ end end