Created
April 26, 2014 07:39
-
-
Save kamiyam/11314203 to your computer and use it in GitHub Desktop.
Gruntfile for Node.js Framework Express
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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