Skip to content

Commit

Permalink
Merge pull request tompollard#4 from ArcoMul/add-grunt
Browse files Browse the repository at this point in the history
Grunt task file to watch markdown files and auto-compile them
  • Loading branch information
tompollard committed May 13, 2015
2 parents 24020e8 + da57613 commit 83b377d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ target/

# ignore DS store files
.DS_Store

# Node modules
node_modules/
41 changes: 41 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = function(grunt) {

var type = grunt.option('type');
if(!type) type = 'pdf:html';

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
notify: {
make: {
options: {
message: "Compilation done"
}
}
},
watch: {
options: {
interrupt: true
},
scripts: {
files: ['source/*.md'],
tasks: ['make:' + type, 'notify:make']
}
},
notify_hooks: {
options: {
enabled: true,
max_jshint_notifications: 5, // maximum number of notifications from jshint output
title: "Thesis compilation", // defaults to the name in package.json, or will use project directory's name
success: true, // whether successful grunt executions should be notified automatically
duration: 2 // the duration of notification in seconds, for `notify-send only
}
}
});

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-make');
grunt.loadNpmTasks('grunt-notify');

grunt.registerTask('default', ['make:' + type]);
};
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Some useful points, in a random order:
- the template uses [John Macfarlane's Pandoc](http://johnmacfarlane.net/pandoc/README.html) to generate the output documents. Refer to this page for Markdown formatting guidelines.
- PDFs are generated using the Latex templates in the style directory. Fonts etc can be changed in the tex templates.
- To change the citation style, just overwrite ref_format.csl with the new style. Style files can be obtained from [citationstyles.org/](http://citationstyles.org/)
- For fellow web developers, there is a Grunt task file (Gruntfile.js) which can be used to 'watch' the markdown files. By running `$ npm install` and then `$ npm run-script watch` the PDF and HTML export is done automatically when saving a Markdown file.

# Contributing

Expand Down
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "MarkdownThesis",
"version": "1.0.0",
"scripts": {
"watch": "grunt watch"
},
"dependencies": {
"grunt-cli": "^0.1.13",
"grunt": "^0.4.5",
"grunt-contrib-watch": "^0.6.1",
"grunt-make": "^1.0.0",
"grunt-notify": "^0.4.1"
}
}

0 comments on commit 83b377d

Please sign in to comment.