Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post compilation hook in Compass

I need a Compass hook after compiler compile all SCSS files to CSS in STANDALONE (no Rails) project.

Is there any post-compile hook in compass other than editing "compiler.rb" (which is not good solution, because of gem updates)?

like image 671
Krzysztof Romanowski Avatar asked Feb 16 '26 03:02

Krzysztof Romanowski


2 Answers

Ok I found it ;) Compass has this hooks:

  • on_sprite_saved
  • on_sprite_generated
  • on_sprite_removed
  • on_stylesheet_saved (this is what I was looked for)
  • on_stylesheet_error

Sad, that on http://compass-style.org/ there is no info about any hook.

like image 184
Krzysztof Romanowski Avatar answered Feb 18 '26 17:02

Krzysztof Romanowski


The Compass callbacks are documented in the Callbacks section of http://compass-style.org/help/documentation/configuration-reference/#callbacks.

The on_stylesheet_saved hook will fire after a .css file is compiled. You can invoke it by adding the following to the bottom of your config.rb file:

on_stylesheet_saved do |file|
  #Do Ruby stuff. Below outputs to command line.
  puts ">>>> ZOMG"
end
like image 37
KatieK Avatar answered Feb 18 '26 15:02

KatieK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!