提交 7cfd1bd7 编写于 作者: J José Valim

Merge pull request #4385 from r-stu31/static_compiler_option_zip_files

Sprockets::StaticCompiler: option ":zip_files"
......@@ -11,6 +11,7 @@ def initialize(env, target, paths, options = {})
@digest = options.key?(:digest) ? options.delete(:digest) : true
@manifest = options.key?(:manifest) ? options.delete(:manifest) : true
@manifest_path = options.delete(:manifest_path) || target
@zip_files = options.delete(:zip_files) || /\.(?:css|html|js|svg|txt|xml)$/
end
def compile
......@@ -36,7 +37,7 @@ def write_asset(asset)
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)$/
asset.write_to("#{filename}.gz") if filename.to_s =~ @zip_files
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册