Compile CoffeeScript on Save?

前端 未结 7 1141
花落未央
花落未央 2020-12-24 01:11

Is there anyway to easily compile CoffeeScript on save? I\'m using TextMate or Sublime Text 2.

7条回答
  •  半阙折子戏
    2020-12-24 01:50

    Well coffee --watch has 2 major flaws:

    • New files created after command has been issued aren't being watched
    • Requires manual initiation so there can be a chance you forget to do it, which doesn't sound more brilliant than forget to compile before you git commit it

    The solution I came up with is a rather simple Bash script that takes coffee --watch a few steps further which will allow your working directory tree to be watched ever since system login, and automatically get compiled into JavaScript on each file save/change or new file creation:

    http://blog.gantrithor.com/post/11609373640/carefree-coffeescript-auto-compiler

    There may be more elegant way to do this, but this implementation works great =)

提交回复
热议问题