Created
March 14, 2015 05:41
-
-
Save Jman/803733e6f6476b5533e4 to your computer and use it in GitHub Desktop.
Compile only edited haml file (using grunt-haml2html grunt task)
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
module.exports = function(grunt) { | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
haml: { | |
options: { | |
doubleQuoteAttributes : true | |
}, | |
main: { | |
files : [ | |
{ expand: true, cwd:'.', src: '**/*.haml', dest: '.', ext : '.html' } | |
] | |
}, | |
watch: { | |
files : {} | |
} | |
}, | |
watch: { | |
haml: { | |
files: '**/*.haml', | |
tasks: ['haml:watch'], | |
options: { | |
spawn: false | |
} | |
} | |
} | |
}); | |
grunt.event.on('watch', function(action, filepath) { | |
if(filepath.indexOf('.haml') === -1) return; | |
grunt.log.writeln('filepath = ' + filepath); | |
var file = {}; | |
var destfile = filepath.replace('.haml','.html'); | |
file[destfile] = filepath; | |
grunt.config('haml.watch.files', file); | |
}); | |
grunt.registerTask('default', ['haml:main']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment