Skip to content

Instantly share code, notes, and snippets.

@carlos-reynosa
Last active August 29, 2015 14:03
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 carlos-reynosa/11f9c935aa74807762ab to your computer and use it in GitHub Desktop.
Save carlos-reynosa/11f9c935aa74807762ab to your computer and use it in GitHub Desktop.
Grunt dependencies and tasks for running a php and livereload server in a project.
/**
* Tasks for running the php dev server and livereload server
*
*/
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
open:{
dev:{
path:'http://localhost:9000'
}
},
shell:{
/**
* Provides and easy server for development.
*/
server:{
command: 'php -S localhost:9000'
},
/**
* Uses the node implementation of livereload for refreshing the browser.
*/
livereload:{
//Only look for changes in the newly regenerated blog in the public folder
command: 'livereloadx .'
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-open');
grunt.registerTask('server',['open:dev','shell:server']);
grunt.registerTask('watch',['shell:livereload']);
};
{
"name": "package-name",
"version": "0.0.0",
"description": "insert description",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Carlos E. Reynosa",
"license": "BSD-2-Clause",
"devDependencies": {
"grunt": "~0.4.5",
//For running shell tasks
"grunt-shell": "~0.7.0",
//for starting livereload server
"livereloadx": "~0.3.4",
"grunt-cli": "~0.1.13",
"grunt-open": "~0.2.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment