admin管理员组文章数量:1180465
When I run express app_name, expressjs creates all the folders and files needed. I'm wondering if there's a way to do the same but instead of creating the app.js in JS, it creates in CoffeeScript.
Thanks
When I run express app_name, expressjs creates all the folders and files needed. I'm wondering if there's a way to do the same but instead of creating the app.js in JS, it creates in CoffeeScript.
Thanks
Share Improve this question asked Sep 2, 2011 at 14:06 donalddonald 23.7k45 gold badges145 silver badges223 bronze badges5 Answers
Reset to default 12Try this: https://github.com/twilson63/express-coffee
express-coffee is a template or boiler-plate to get started writing express web applications in CoffeeScript. It comes ready to go with base setup for an Express Web App. It includes a Cakefile that lets you build, spec, and watch your coffeescript as you develop. You hack in the src folder and run cake build to build you server files, write your mocha in your test folder and run cake test or spec to run your test suite. Create your jade views in the views folder and put your public assets in the public folder...
You may want to check out skeleton. I also created frappe, which is similar but tweaked for my taste.
I don't think there's a command-line tool to do this, but there are plenty of template projects you could start from. In particular, I'd recommend sstephenson's node-coffee-project. It's not Express specific, but you can easily throw Express into the package.json
and create a src/app.coffee
file that looks something like
express = require 'express'
app = express.createServer()
# TODO: configuration
app.listen 3000
The important thing is to have a Cakefile
that can do the tasks your project needs. For an Express project, you might want to add a task that not only continuously recompiles your CoffeeScript, but also restarts the server every time you change a source file. Here's a gist of a Cakefile I'm using on one of my projects (you'll have to add "watch-tree"
to your `devDependencies).
ExpressOnSteroids Express + SCSS + COFFEE SCRIPT
clone project and start cake task /path/to/cake dev
just found that there is a project called 'zappa' on github that might be helpful to you http://zappajs.org
本文标签: javascriptNodejs Create an Express project using CoffeeScriptStack Overflow
版权声明:本文标题:javascript - Node.js: Create an Express project using CoffeeScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738177542a2067324.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论