module Roda::RodaPlugins::Assets::ClassMethods
def compile_assets_files(files, type, dirs)
file. Dirs should be an array of asset group names, if these
Compile each array of files for the given type into a single
def compile_assets_files(files, type, dirs) dirs = nil if dirs && dirs.empty? o = assets_opts app = allocate content = files.map do |file| file = "#{dirs.join('/')}/#{file}" if dirs && o[:group_subdirs] file = "#{o[:"#{type}_path"]}#{file}" app.read_asset_file(file, type) end.join("\n") unless o[:concat_only] content = compress_asset(content, type) end suffix = ".#{dirs.join('.')}" if dirs key = "#{type}#{suffix}" unique_id = o[:compiled][key] = asset_digest(content) path = "#{o[:"compiled_#{type}_path"]}#{suffix}.#{unique_id}.#{type}" ::FileUtils.mkdir_p(File.dirname(path)) ::File.open(path, 'wb'){|f| f.write(content)} if o[:gzip] require 'zlib' Zlib::GzipWriter.open("#{path}.gz") do |gz| gz.write(content) end end nil end