Created
January 8, 2013 17:24
-
-
Save anonymous/4485810 to your computer and use it in GitHub Desktop.
Rubbish wee grunt file to watch a set of files and spawn multimarkdown for any that change. Requires nodejs, grunt and multimarkdown installed and in the path env.
This file contains hidden or 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
| /*global module:false process:false*/ | |
| var path = require('path'); | |
| var child_process = require('child_process'); | |
| module.exports = function (grunt) { | |
| 'use strict'; | |
| grunt.initConfig({ | |
| watch: { | |
| 'markdown': { | |
| files: ['*.md', '../Dropbox/Blogging/*.md', '../Dropbox/Workbook Blog posts/*.md'], | |
| tasks: 'markdown' | |
| } | |
| }, | |
| markdown: { | |
| all: { | |
| files: ['*.md', '../Dropbox/Blogging/*.md', '../Dropbox/Workbook Blog posts/*.md'] | |
| } | |
| } | |
| }); | |
| grunt.registerMultiTask('markdown', 'A sample task that logs stuff.', function () { | |
| var files = grunt.file.expandFiles(this.data.files); | |
| for(var i = files.length - 1; i >= 0; i--) { | |
| var file = files[i]; | |
| var output = file.replace(/\.(txt|md)/, '\.html', 'i'); | |
| console.log(output); | |
| grunt.utils.spawn({ | |
| cmd: 'multimarkdown', | |
| args: [file, '-o', output] | |
| }, function () {}); | |
| } | |
| }); | |
| grunt.registerTask('default', 'watch'); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment