Skip to content

Instantly share code, notes, and snippets.

@kamiyam
Created April 26, 2014 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamiyam/11314203 to your computer and use it in GitHub Desktop.
Save kamiyam/11314203 to your computer and use it in GitHub Desktop.
Gruntfile for Node.js Framework Express
"use strict"
LIVERELOAD_PORT = 35729
proxySnippet = require("grunt-connect-proxy/lib/utils").proxyRequest
mountFolder = folderMount = (connect, base) ->
connect["static"] require("path").resolve(base)
listen = 8000
server = 3000
module.exports = (grunt) ->
require("matchdep").filterDev("grunt-*").forEach grunt.loadNpmTasks
grunt.initConfig
connect:
front:
options:
host: "localhost"
port: listen
middleware: (connect) ->
[
mountFolder(connect, ".")
proxySnippet
]
open:
target: "http://localhost:" + listen
livereload: true
proxies: [
context: "/"
host: "localhost"
port: server + ""
https: false
changeOrigin: false
]
express:
dev:
options:
background: true
port: server
cmd: "forever"
args: ["-w"]
script: "app.js"
delay: 0
watch:
options:
livereload: true
express:
files: [
"app.js"
"routes/**/*.js"
"views/**/*.jade"
]
tasks: ["express:dev"]
veiw:
files: ["public/**/*.{js,css}"]
grunt.registerTask "server", [
"configureProxies"
"express:dev"
"connect:front"
"watch"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment