just making grunt hook in with converter used in tasks/cml.js

master
Matt Huntington 10 years ago
parent 1422e44059
commit e5250ab947

@ -1,36 +1,42 @@
var cml_html_converter = require('cml-html-converter'); module.exports = function(grunt) {
var result = cml_html_converter('line1\n\tline2');
console.log(result); grunt.registerMultiTask('cml', 'Grunt task for converting CML to HTML', function() {
grunt.registerMultiTask('cml_html_converter', 'Grunt task for converting CML to HTML', function() { var cml_html_converter = require('cml-html-converter');
// Merge task-specific and/or target-specific options with these defaults. var result = cml_html_converter('line1\n\tline2');
var options = this.options({ console.log(result);
punctuation: '.', /*
separator: ', ' // Merge task-specific and/or target-specific options with these defaults.
}); var options = this.options({
punctuation: '.',
separator: ', '
});
// Iterate over all specified file groups. // Iterate over all specified file groups.
this.files.forEach(function(f) { this.files.forEach(function(f) {
// Concat specified files. // Concat specified files.
var src = f.src.filter(function(filepath) { var src = f.src.filter(function(filepath) {
// Warn on and remove invalid source files (if nonull was set). // Warn on and remove invalid source files (if nonull was set).
if (!grunt.file.exists(filepath)) { if (!grunt.file.exists(filepath)) {
grunt.log.warn('Source file "' + filepath + '" not found.'); grunt.log.warn('Source file "' + filepath + '" not found.');
return false; return false;
} else { } else {
return true; return true;
} }
}).map(function(filepath) { }).map(function(filepath) {
// Read file source. // Read file source.
return grunt.file.read(filepath); return grunt.file.read(filepath);
}).join(grunt.util.normalizelf(options.separator)); }).join(grunt.util.normalizelf(options.separator));
// Handle options. // Handle options.
src += options.punctuation; src += options.punctuation;
// Write the destination file. // Write the destination file.
grunt.file.write(f.dest, src); grunt.file.write(f.dest, src);
// Print a success message. // Print a success message.
grunt.log.writeln('File "' + f.dest + '" created.'); grunt.log.writeln('File "' + f.dest + '" created.');
});
*/
}); });
});
};

Loading…
Cancel
Save