Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Created April 8, 2012 20:28
Show Gist options
  • Save chriseppstein/2339700 to your computer and use it in GitHub Desktop.
Save chriseppstein/2339700 to your computer and use it in GitHub Desktop.
if environment == :production
on_stylesheet_saved do |file|
# pretty logging output when making a gzipp'ed file
gz_file = Pathname.new("#{file}.gz").relative_path_from(Pathname.new(project_path))
Compass::Logger.new.record(:create, gz_file)
# This generates a file of the same name but ending in .gz
`gzip -f #{file}`
end
end
@makeaweli
Copy link

If you'd like to keep the original .css files along with the .gzip files, use the -k argument for gzip:

if environment == :production
on_stylesheet_saved do |file|
# pretty logging output when making a gzipp'ed file
gz_file = Pathname.new("#{file}.gz").relative_path_from(Pathname.new(project_path))
Compass::Logger.new.record(:create, gz_file)
# This generates a file of the same name but ending in .gz
gzip -fk #{file}
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment