Last active
December 7, 2017 20:46
-
-
Save Hypercubed/6841482 to your computer and use it in GitHub Desktop.
DocPad is great.... but so is Grunt. Use grunt-contrib-connect and grunt-contrib-watch instead of docpad's server and watcher.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
docpad: { | |
files: [ "./src/**/*.*" ], | |
out: ["out"] | |
}, | |
watch: { | |
src: { | |
files: ['<%= docpad.files %>'], | |
tasks: ['shell:docpad'], | |
}, | |
out: { | |
files: ['<%= docpad.out %>/**/*'], | |
options: { livereload: true } | |
} | |
}, | |
connect: { | |
server: { | |
options: { | |
port: 9778, | |
hostname: 'localhost', | |
base: '<%= docpad.out %>', | |
livereload: true, | |
open: true | |
} | |
} | |
}, | |
clean: { | |
options: { force: true }, | |
out: ['<%= docpad.out %>/*'] | |
}, | |
shell: { | |
docpad: { | |
options: { | |
stdout: true | |
}, | |
command: "docpad generate --env static" | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-shell'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-connect'); | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.registerTask('generate', ['clean','shell:docpad']); | |
grunt.registerTask('server', ['connect','watch']); | |
grunt.registerTask('run', ['generate','server']); | |
grunt.registerTask('default', ['run']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment