Skip to content

Instantly share code, notes, and snippets.

@crishushu
Last active August 29, 2015 14:02
Show Gist options
  • Save crishushu/a85fba64906e52c40520 to your computer and use it in GitHub Desktop.
Save crishushu/a85fba64906e52c40520 to your computer and use it in GitHub Desktop.
Gruntjs: Skeleton for client-side debugging
module.exports = function(grunt) {
grunt.initConfig({
npmEnv: '', // path to node_modules folder
debugPort: '', // debugger port
connectPort: , // connector port 35725
base: '.', // path to index
watch: {
refresh: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: ['<%= base %>/**/*.js' // files to monitor
]
}
},
connect: {
options: {
port: '<%= debugPort %>',
hostname: 'localhost',
livereload: '<%= connectPort %>'
},
browser: {
options: {
open: true,
base: ['.tmp', '<%= base %>']
}
}
}
});
var NPM_ENV = grunt.config.get('npmEnv');
require(NPM_ENV + 'grunt-contrib-connect/tasks/connect')(grunt);
require(NPM_ENV + 'grunt-contrib-watch/tasks/watch')(grunt);
grunt.registerTask('serve', ['connect:browser', 'watch:refresh']);
grunt.registerTask('default', ['serve']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment