Skip to content

Instantly share code, notes, and snippets.

@takada-at
Created July 23, 2015 17:46
Show Gist options
  • Save takada-at/3b76e52f3d1a31b1b1e7 to your computer and use it in GitHub Desktop.
Save takada-at/3b76e52f3d1a31b1b1e7 to your computer and use it in GitHub Desktop.
var path = require('path');
module.exports = function (aGrunt) {
// The property points to the "package.json" file.
// -----------------------------------------------
var pkg = aGrunt.file.readJSON('package.json');
var taskName;
for (taskName in pkg.devDependencies) {
if (taskName.substring(0, 6) === 'grunt-') {
aGrunt.loadNpmTasks(taskName);
}
}
var mountDir = function (aConnect, aPoint) {
return aConnect.static(path.resolve(aPoint));
};
aGrunt.initConfig({
// @see https://github.com/gruntjs/grunt-contrib-connect
// ------------------------------------------------------
connect: {
options: {
port: 8001,
hostname: 'localhost'
},
dev: {
options: {
middleware: function (aConnect) {
return [
require('connect-livereload')(),
mountDir(aConnect, '.')
];
}
}
}
},
// @see https://github.com/jharding/grunt-exec
// --------------------------------------------
exec: {
pandoc: {
command: 'panzer pandoc.txt -t dzslides --slide-level 2 --self-contained -o build/slide.html'
}
},
// @see https://github.com/gruntjs/grunt-contrib-watch
// ----------------------------------------------------
watch: {
pandoc: {
files: ['**/*.txt'],
tasks: ['exec:pandoc'],
options: {
livereload: true
}
}
}
});
aGrunt.registerTask('default', ['connect', 'watch:pandoc']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment