Created
November 9, 2011 15:25
-
-
Save pk/1351769 to your computer and use it in GitHub Desktop.
Nanoc Juicer filter for minifying CSS/JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PK | |
module Filter | |
class Juice < Nanoc3::Filter | |
identifier :juice | |
type :text | |
def run(content, params={}) | |
input_filename = File.join('content', @item.path) | |
output_filename = File.absolute_path(File.join('tmp', "#{@item.path}")) | |
system('juicer', 'merge', '--force', '-o', output_filename, input_filename) | |
minified = File.open(output_filename, 'r') { |f| f.read } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment