grunt-processhtml
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2013-2015 Denis Ciccale (@tdecs) | ||
* Copyright (c) 2013-2023 Denis Ciccale (@dciccale) | ||
* Licensed under the MIT license. | ||
@@ -41,3 +41,5 @@ * https://github.com/dciccale/grunt-processhtml/blob/master/LICENSE-MIT | ||
files: { | ||
'test/fixtures/dist/index.processed.html': ['test/fixtures/index.html'] | ||
'test/fixtures/dist/index.processed.html': [ | ||
'test/fixtures/index.html' | ||
] | ||
} | ||
@@ -55,3 +57,5 @@ }, | ||
files: { | ||
'test/fixtures/custom/custom.processed.html': ['test/fixtures/custom.html'] | ||
'test/fixtures/custom/custom.processed.html': [ | ||
'test/fixtures/custom.html' | ||
] | ||
} | ||
@@ -67,3 +71,5 @@ }, | ||
files: { | ||
'test/fixtures/commentMarker/commentMarker.processed.html': ['test/fixtures/commentMarker.html'] | ||
'test/fixtures/commentMarker/commentMarker.processed.html': [ | ||
'test/fixtures/commentMarker.html' | ||
] | ||
} | ||
@@ -76,3 +82,5 @@ }, | ||
files: { | ||
'test/fixtures/strip/strip.processed.html': ['test/fixtures/strip.html'] | ||
'test/fixtures/strip/strip.processed.html': [ | ||
'test/fixtures/strip.html' | ||
] | ||
} | ||
@@ -85,3 +93,5 @@ }, | ||
files: { | ||
'test/fixtures/inline/inline.processed.html': ['test/fixtures/inline.html'] | ||
'test/fixtures/inline/inline.processed.html': [ | ||
'test/fixtures/inline.html' | ||
] | ||
} | ||
@@ -95,3 +105,5 @@ }, | ||
files: { | ||
'test/fixtures/multiple/mult_one.processed.html': ['test/fixtures/multiple.html'] | ||
'test/fixtures/multiple/mult_one.processed.html': [ | ||
'test/fixtures/multiple.html' | ||
] | ||
} | ||
@@ -101,3 +113,5 @@ }, | ||
files: { | ||
'test/fixtures/multiple/mult_two.processed.html': ['test/fixtures/multiple.html'] | ||
'test/fixtures/multiple/mult_two.processed.html': [ | ||
'test/fixtures/multiple.html' | ||
] | ||
} | ||
@@ -107,3 +121,5 @@ }, | ||
files: { | ||
'test/fixtures/multiple/mult_three.processed.html': ['test/fixtures/multiple.html'] | ||
'test/fixtures/multiple/mult_three.processed.html': [ | ||
'test/fixtures/multiple.html' | ||
] | ||
} | ||
@@ -113,3 +129,5 @@ }, | ||
files: { | ||
'test/fixtures/include/include.processed.html': ['test/fixtures/include.html'] | ||
'test/fixtures/include/include.processed.html': [ | ||
'test/fixtures/include.html' | ||
] | ||
} | ||
@@ -119,3 +137,5 @@ }, | ||
files: { | ||
'test/fixtures/conditional_ie/conditional_ie.processed.html': ['test/fixtures/conditional_ie.html'] | ||
'test/fixtures/conditional_ie/conditional_ie.processed.html': [ | ||
'test/fixtures/conditional_ie.html' | ||
] | ||
} | ||
@@ -128,3 +148,5 @@ }, | ||
files: { | ||
'test/fixtures/recursive/recursive.processed.html': ['test/fixtures/recursive.html'] | ||
'test/fixtures/recursive/recursive.processed.html': [ | ||
'test/fixtures/recursive.html' | ||
] | ||
} | ||
@@ -137,3 +159,5 @@ }, | ||
files: { | ||
'test/fixtures/custom_blocktype/custom_blocktype.processed.html': ['test/fixtures/custom_blocktype.html'] | ||
'test/fixtures/custom_blocktype/custom_blocktype.processed.html': [ | ||
'test/fixtures/custom_blocktype.html' | ||
] | ||
} | ||
@@ -149,3 +173,5 @@ }, | ||
files: { | ||
'test/fixtures/template/template.processed.html': ['test/fixtures/template.html'] | ||
'test/fixtures/template/template.processed.html': [ | ||
'test/fixtures/template.html' | ||
] | ||
} | ||
@@ -152,0 +178,0 @@ } |
{ | ||
"name": "grunt-processhtml", | ||
"description": "Process html files at build time to modify them depending on the release environment", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"homepage": "https://github.com/dciccale/grunt-processhtml", | ||
@@ -9,3 +9,3 @@ "author": { | ||
"email": "dciccale@gmail.com", | ||
"url": "http://twitter.com/tdecs" | ||
"url": "http://twitter.com/dciccale" | ||
}, | ||
@@ -34,3 +34,3 @@ "repository": { | ||
"async": "^3.2.3", | ||
"htmlprocessor": "0.3.2", | ||
"htmlprocessor": "0.3.3", | ||
"lodash": "4.17.21" | ||
@@ -37,0 +37,0 @@ }, |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2013-2014 Denis Ciccale (@tdecs) | ||
* Copyright (c) 2013-2023 Denis Ciccale (@dciccale) | ||
* Licensed under the MIT license. | ||
@@ -20,55 +20,71 @@ * https://github.com/dciccale/grunt-processhtml/blob/master/LICENSE-MIT | ||
module.exports = function (grunt) { | ||
grunt.registerMultiTask( | ||
'processhtml', | ||
'Process html files at build time to modify them depending on the release environment', | ||
function () { | ||
var options = this.options({ | ||
process: false, | ||
data: {}, | ||
templateSettings: null, | ||
includeBase: null, | ||
commentMarker: 'build', | ||
strip: false, | ||
recursive: false, | ||
customBlockTypes: [], | ||
environment: this.target | ||
}); | ||
grunt.registerMultiTask('processhtml', 'Process html files at build time to modify them depending on the release environment', function () { | ||
var options = this.options({ | ||
process: false, | ||
data: {}, | ||
templateSettings: null, | ||
includeBase: null, | ||
commentMarker: 'build', | ||
strip: false, | ||
recursive: false, | ||
customBlockTypes: [], | ||
environment: this.target | ||
}); | ||
var done = this.async(); | ||
var html = new HTMLProcessor(options); | ||
var done = this.async(); | ||
var html = new HTMLProcessor(options); | ||
async.eachSeries( | ||
this.files, | ||
function (f, n) { | ||
var destFile = path.normalize(f.dest); | ||
async.eachSeries(this.files, function (f, n) { | ||
var destFile = path.normalize(f.dest); | ||
var srcFiles = f.src.filter(function (filepath) { | ||
// Warn on and remove invalid source files (if nonull was set). | ||
if (!grunt.file.exists(filepath)) { | ||
grunt.log.warn('Source file "' + filepath + '" not found.'); | ||
return false; | ||
} | ||
return true; | ||
}); | ||
var srcFiles = f.src.filter(function (filepath) { | ||
// Warn on and remove invalid source files (if nonull was set). | ||
if (!grunt.file.exists(filepath)) { | ||
grunt.log.warn('Source file "' + filepath + '" not found.'); | ||
return false; | ||
} | ||
return true; | ||
}); | ||
if (srcFiles.length === 0) { | ||
// No src files, goto next target. Warn would have been issued above. | ||
return n(); | ||
} | ||
if (srcFiles.length === 0) { | ||
// No src files, goto next target. Warn would have been issued above. | ||
return n(); | ||
} | ||
var result = []; | ||
async.concatSeries( | ||
srcFiles, | ||
function (file, next) { | ||
var content = html.process(file); | ||
var result = []; | ||
async.concatSeries(srcFiles, function (file, next) { | ||
if (options.process) { | ||
content = html.template( | ||
content, | ||
lodash.cloneDeep(html.data), | ||
options.templateSettings | ||
); | ||
} | ||
var content = html.process(file); | ||
if (options.process) { | ||
content = html.template(content, lodash.cloneDeep(html.data), options.templateSettings); | ||
} | ||
result.push(content); | ||
process.nextTick(next); | ||
}, function () { | ||
grunt.file.write(destFile, result.join(grunt.util.normalizelf(grunt.util.linefeed))); | ||
grunt.verbose.writeln('File ' + destFile.cyan + ' created.'); | ||
n(); | ||
}); | ||
}, done); | ||
}); | ||
result.push(content); | ||
process.nextTick(next); | ||
}, | ||
function () { | ||
grunt.file.write( | ||
destFile, | ||
result.join(grunt.util.normalizelf(grunt.util.linefeed)) | ||
); | ||
grunt.verbose.writeln('File ' + destFile.cyan + ' created.'); | ||
n(); | ||
} | ||
); | ||
}, | ||
done | ||
); | ||
} | ||
); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24920
6
250
+ Addedhtmlprocessor@0.3.3(transitive)
- Removedhtmlprocessor@0.3.2(transitive)
Updatedhtmlprocessor@0.3.3