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
@astrotim
Copy link

astrotim commented Feb 8, 2013

I am getting am error from this... perhaps it is something to do with the Windows path?

   create css/bootstrap/bootstrap.css.gz
Errno::ENOENT on line ["27"] of D: 
No such file or directory - gzip -f D:\path\to\theme/css/bootstrap/bootstrap.css

Any help would be greatly appreciated over and above the existing immense appreciation for Compass :)

@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