Skip to content

Instantly share code, notes, and snippets.

@gjjones
Created April 21, 2014 00:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjjones/11129070 to your computer and use it in GitHub Desktop.
Save gjjones/11129070 to your computer and use it in GitHub Desktop.
This is a sample Gruntfile to run the basic 'jekyll build' with local server and livereload on changes. The grunt plugin can do this stuff without connect/watch, but I wanted more control over the options for other build steps.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
default: {
files: ['**/*.*', '!_site/**.*'],
tasks: ['jekyll'],
options: {
livereload: true
}
}
},
connect: {
default: {
options: {
hostname: 'localhost',
port: 9000,
livereload: true,
base: './_site',
open: { appName: 'chrome' }
}
}
},
jekyll: {
default: {
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-jekyll');
grunt.registerTask('build', ['jekyll']);
grunt.registerTask('default', ['jekyll', 'connect', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment