Skip to content

Instantly share code, notes, and snippets.

@velickym
Last active September 24, 2020 15:44
Show Gist options
  • Save velickym/ad53cbba30ffb92599461aa891844c3f to your computer and use it in GitHub Desktop.
Save velickym/ad53cbba30ffb92599461aa891844c3f to your computer and use it in GitHub Desktop.
Grunt.js local development template
module.exports = function(grunt) {
grunt.initConfig({
connect : {
default : {
options : {
port : 4478,
livereload : 35728,
hostname : '*'
}
}
},
watch : {
scripts : {
files : ['**/*.css', '**/*.html', '**/*.js', '**/*.json']
},
options : {
livereload : 35728,
spawn : false
}
}
});
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-connect");
// Default task(s).
grunt.registerTask('default', ['connect', 'watch']);
};
{
"name": "Grunt.js setup for local web development",
"version": "0.0.1",
"description": "Copy your HTML, JS and CSS files anywhere in the folder and have it reloaded on localhost:4478",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Martin Velicky",
"license": "BSD-2-Clause",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-watch": "^1.0.0"
}
}
@velickym
Copy link
Author

  1. Add your HTML, JS and CSS
  2. Run npm install and then grunt
  3. Open localhost:4478 in your browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment