When I run express app_name, expressjs crea开发者_StackOverflowtes 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
Try 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
精彩评论