Created
March 10, 2014 18:20
-
-
Save hcosta/9470942 to your computer and use it in GitHub Desktop.
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
$ cd project | |
$ nano package.json | |
{ | |
"name": "", | |
"version": "", | |
"description": "", | |
"main": "index.html", | |
"author": "", | |
"license": "", | |
"devDependencies": { | |
"grunt": "~0.4.3", | |
"grunt-contrib-watch": "~0.5.3", | |
"grunt-contrib-connect": "~0.7.1", | |
"grunt-contrib-sass": "~0.7.3", | |
"grunt-open": "~0.2.3", | |
"matchdep": "~0.3.0" | |
} | |
} | |
$ npm install | |
$ nano Gruntfile | |
'use strict'; | |
// Gruntfile with the configuration of grunt-express and grunt-open. No livereload yet! | |
module.exports = function(grunt) { | |
// Load Grunt tasks declared in the package.json file | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
// Configure Grunt | |
grunt.initConfig({ | |
// grunt-express will serve the files from the folders listed in `bases` | |
// on specified `port` and `hostname` | |
connect: { | |
options: { | |
port: 9000, | |
// Change this to '0.0.0.0' to access the server from outside. | |
hostname: 'localhost', | |
// base: 'app', | |
livereload: 35729 | |
}, | |
livereload: { | |
options: { | |
open: true, | |
} | |
} | |
}, | |
sass: { | |
dist: { | |
files: { | |
'css/style.css' : 'sass/style.scss' | |
} | |
} | |
}, | |
watch: { | |
sass: { | |
files: '**/*.scss', | |
tasks: ['sass'] | |
}, | |
css: { | |
files: '**/*.css', | |
options: { | |
livereload: true | |
} | |
}, | |
html: { | |
files: ['**/*.html'], | |
options: { | |
livereload: true | |
} | |
} | |
}, | |
// grunt-open will open your browser at the project's URL | |
open: { | |
all: { | |
// Gets the port from the connect configuration | |
path: 'http://localhost:9000' | |
} | |
} | |
}); | |
// Creates the `server` task | |
grunt.registerTask('server', [ | |
'connect:livereload', | |
'open', | |
'watch' | |
]); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment