grunt-processhtml
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "grunt-processhtml", | ||
"description": "Process html files at build time to modify them depending on the release environment", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/dciccale/grunt-processhtml", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -46,5 +46,7 @@ # grunt-processhtml [![Build Status](https://travis-ci.org/dciccale/grunt-processhtml.png?branch=master)](https://travis-ci.org/dciccale/grunt-processhtml) [![NPM version](https://badge.fury.io/js/grunt-processhtml.png)](http://badge.fury.io/js/grunt-processhtml) | ||
<!-- build:[src] js/ --> | ||
<script src="my/lib/path/lib.js"></script> | ||
<script src="my/deep/development/path/script.js"></script> | ||
<!-- /build --> | ||
<!-- this will change only the path to --> | ||
<script src="js/lib.js"></script> | ||
<script src="js/script.js"></script> | ||
@@ -56,3 +58,3 @@ | ||
<!-- build:dist:remove --> | ||
<!-- build:remove:dist --> | ||
<p>But this one only when doing processhtml:dist</p> | ||
@@ -100,3 +102,3 @@ <!-- /build --> | ||
Process the entire `html` file through `grunt.template.process`, a default object with the buld target will be passed to the | ||
Process the entire `html` file through `grunt.template.process`, a default object with the build target will be passed to the | ||
template in the form of `{environment: target}` where environment will be the build target of the grunt task. | ||
@@ -132,4 +134,6 @@ | ||
}, | ||
files: { | ||
'dest/index.html': ['index.html'] | ||
dist: { | ||
files: { | ||
'dest/index.html': ['index.html'] | ||
} | ||
} | ||
@@ -163,3 +167,3 @@ } | ||
<p>This is the html file without being processed</p> | ||
<!-- remove --> | ||
<!-- /build --> | ||
@@ -200,3 +204,3 @@ <!-- build:js app.min.js --> | ||
files: { | ||
'dest/index.html': ['index.html'] | ||
'dev/index.html': ['index.html'] | ||
} | ||
@@ -211,2 +215,5 @@ }, | ||
} | ||
}, | ||
files: { | ||
'dest/index.html': ['index.html'] | ||
} | ||
@@ -223,3 +230,3 @@ } | ||
<!-- notice that no special comment is used here, as process is true. | ||
if you don't mine having <%= title %> as the title of your app | ||
if you don't mind having <%= title %> as the title of your app | ||
when not being processed, is a perfectly valid title string --> | ||
@@ -239,7 +246,7 @@ <title><%= title %></title> | ||
<p>This is the html file without being processed</p> | ||
<!-- remove --> | ||
<!-- /build --> | ||
<!-- build:dist:remove --> | ||
<!-- build:remove:dist --> | ||
<script src="js/libs/require.js" data-main="js/config.js"></script> | ||
<!-- --> | ||
<!-- /build --> | ||
@@ -259,2 +266,3 @@ <!-- build:template | ||
## Release History | ||
- 0.1.1 Lint js files inside tasks/lib/ | ||
- 0.1.0 Initial release |
@@ -73,4 +73,3 @@ 'use strict'; | ||
replaceAsset: function (content, block, blockLine, asset) { | ||
var result = content.replace(blockLine, block.indent + asset); | ||
return result; | ||
return content.replace(blockLine, block.indent + asset); | ||
}, | ||
@@ -88,3 +87,3 @@ | ||
// only run attr replacer for the block content | ||
var re = new RegExp('(\s*(?:' + block.attr + ')=[\'"])(.*)?(".*)', 'gi'); | ||
var re = new RegExp('(\\s*(?:' + block.attr + ')=[\'"])(.*)?(".*)', 'gi'); | ||
var replacedBlock = blockContent.replace(re, function (wholeMatch, start, asset, end) { | ||
@@ -96,4 +95,3 @@ // check if only the path was provided to leave the original asset name intact | ||
var result = content.replace(blockLine, replacedBlock); | ||
return result; | ||
return content.replace(blockLine, replacedBlock); | ||
}, | ||
@@ -103,4 +101,3 @@ | ||
var blockRegExp = _blockToRegExp(blockLine); | ||
var result = content.replace(blockRegExp, ''); | ||
return result; | ||
return content.replace(blockRegExp, ''); | ||
}, | ||
@@ -112,4 +109,3 @@ | ||
compiledTmpl = block.indent + _.trim(compiledTmpl).replace(/([\r\n])\s*/g, '$1' + block.indent); | ||
var result = content.replace(blockLine, compiledTmpl); | ||
return result; | ||
return content.replace(blockLine, compiledTmpl); | ||
} | ||
@@ -134,3 +130,2 @@ }; | ||
this.blocks.forEach(function (block) { | ||
var replacer; | ||
// parse through correct block type also checking the build target | ||
@@ -137,0 +132,0 @@ if (_blockTypes[block.type] && (!block.target || block.target === this.target)) { |
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
15217
259
153