V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
Seita
V2EX  ›  分享创造

nswatch: 属于 npm scripts 的 gulp.watch

  •  
  •   Seita ·
    egoist · 2016-09-02 13:52:11 +08:00 · 1192 次点击
    这是一个创建于 2812 天前的主题,其中的信息可能已经有所发展或是发生改变。

    检测文件变化然后执行 npm scripts

    // ./watch.js
    const watch = require('nswatch')
    
    watch('src/*.js', ['build'])
    

    preview

    同样可以在 package.json 里配置:

    {
      "watch": {
        "./src/*.js": ["build"],
        "./src/*.css": "compile!minify"
      }
    }
    

    然后在终端里执行:

    $ nswatch
    

    当然也可以直接通过参数运行:

    # in parallel
    $ nswatch "src/*.js" --script foo --script bar
    
    # in sequence
    $ nswatch "src/*.js" --script "foo!bar"
    

    GitHub: https://github.com/egoist/nswatch

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1167 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:40 · PVG 02:40 · LAX 11:40 · JFK 14:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.