Skip to content

Instantly share code, notes, and snippets.

@rodrigobaron
Forked from dannygarcia/grunt.js
Last active August 29, 2015 13:57
Show Gist options
  • Save rodrigobaron/9462165 to your computer and use it in GitHub Desktop.
Save rodrigobaron/9462165 to your computer and use it in GitHub Desktop.

Sample grunt-jekyll grunt.js

  1. Use the following folder structure
[root]
    |-- templates/
        |-- index.html (Jekyll templates)
    |-- prod/
    |-- dev/
    |-- _config.yml (optional)
  1. Add the grunt.js file below at the root of your project.

  2. Install the grunt-jekyll gruntmodule next to your project's grunt.js gruntfile with: npm install grunt-jekyll.

  3. Run the grunt jekyll commands:

  • grunt jekyll or grunt jekyll:server to start a server that watches the templates directory.

  • grunt jekyll:dev to process files to the dev directory.

  • grunt jekyll:prod to process files to the prod directory.

Of course, everything here is fully configurable to your liking.

// Sample grunt-jekyll grunt.js file
// https://github.com/dannygarcia/grunt-jekyll
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jekyll: {
server : {
src : 'templates',
dest: 'dev',
server : true,
server_port : 4000,
auto : true
},
dev: {
src: 'templates',
dest: 'dev'
},
prod: {
src: 'templates',
dest: 'prod'
}
},
watch: { // for development run 'grunt watch'
jekyll: {
files: ['templates/*.html'],
tasks: ['jekyll:dev']
}
}
});
// Default task. Run standard jekyll server.
grunt.registerTask('default', 'jekyll:server');
// plugin tasks
grunt.loadNpmTasks('grunt-jekyll');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment