如何在`compass watch`检测到更改后执行其他命令?

时间:2015-05-13 18:08:01

标签: gruntjs compass-sass compass

我在Zurb Foundation项目中执行了compass watch

效果很好,我的资源在我更改设置时进行编译。

但是,我每次进行更改时都要运行其他一些grunt命令。

如何在检测到更改时添加指南针执行的操作?

具体来说,我想从另一个目录运行两个命令。

这就是我所拥有的:

cd /dir_foundation/
bundle exec compasss watch

每次更改后,我都希望它也可以调用:

grunt sass:dist
grunt cssmin

这些grunt任务在gruntfile中定义,该文件是2个目录" up"来自/dir_foundation/命令监视更改的compass watch

1 个答案:

答案 0 :(得分:1)

我找到了答案。

http://compass-style.org/help/documentation/configuration-reference/#callbacks

这是我添加到config.rb文件中的内容:

on_stylesheet_saved do |file|
  system('../../../compile.bat')
end

where" compile.bat"包含:

grunt sass:dist
grunt cssmin
相关问题