开发者

Coffeescript and CakePHP

Is there an easy way to use Coffeescript with CakePHP? Rails has Barista, but I haven't been able to find anything similar for CakePHP. Ideally, something transparent that would compile the coffeescript to javascript on-demand, and only when it has changed开发者_开发知识库.

Google results for CakePHP & Coffeescript turn up a lot of talk over a clash between the cake command, but not much in the way of using them together. Has anyone found anything? Or maybe ideas on how I might implement such a plugin myself?


I know this isn't the answer you're looking for, but I usually handle this with a build script, either in Bash or Rake (yes, Rake, its great for building PHP projects too), which compiles, concats and compresses my .coffee files for production. While in development I use coffee -w to compile the .coffee files on the fly.

You could automate this further by adding a post-commit hook to Git or Subversion if you like.

You should be able to extend Mark Story's Asset Compress plugin to do the compiling on the fly as well.


You may want to look at kohana-coffeescript, which to my knowledge is the only project that does what you want in PHP. Although the project is nominally for the Kohana framework, it should be fairly easy to fork it and adapt it to CakePHP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜