【问题标题】:How to trigger node-sass to compile with a watch file like the way grunt and ruby sass does?如何触发 node-sass 像 grunt 和 ruby​​ sass 那样使用监视文件进行编译?
【发布时间】:2014-03-11 19:08:53
【问题描述】:

正如标题所述,我想通过 node-sass 来观察/编译 scss 文件到 css,而不需要一遍又一遍地运行命令。

编辑:是否有可以运行 node-sass 而不是 ruby​​ sass 的 grunt 任务?因为我看到的是 grunt-contrib-sass/compass 都用 ruby​​。

【问题讨论】:

标签: css sass node-sass


【解决方案1】:

只需使用监视标志:

node-sass src/styles.scss dist/styles.css -w src

【讨论】:

    【解决方案2】:

    node-sass 没有原生的 watch 任务,但是你可以同时使用grunt-contrib-watchgrunt-sass 来达到想要的效果。

    【讨论】:

    • 但是 grunt-contrib-watch 和 grunt-sass 支持 ruby​​ sass 而不是 node-sass 对吗?
    • grunt-contrib-watch 几乎是一个通用任务,它会监视各种变化,无论是什么类型的编译器,甚至是否正在使用编译器。 Grunt-contrib-sass 用于 ruby​​,而 grunt-sass 用于节点。
    猜你喜欢
    • 2014-04-28
    • 2014-05-04
    • 2018-08-23
    • 2016-10-27
    • 1970-01-01
    • 2018-07-17
    • 2017-04-16
    • 2017-03-16
    • 2015-10-05
    相关资源
    最近更新 更多