grunt-processhtml
Advanced tools
Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "grunt-processhtml", | ||
"description": "Process html files at build time to modify them depending on the release environment", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"homepage": "https://github.com/dciccale/grunt-processhtml", | ||
@@ -31,2 +31,5 @@ "author": { | ||
}, | ||
"dependencies": { | ||
"htmlprocessor": "~0.1.0" | ||
}, | ||
"devDependencies": { | ||
@@ -33,0 +36,0 @@ "grunt": "0.4.1", |
@@ -214,21 +214,25 @@ # 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) | ||
#### options.environment | ||
Type: `Object` | ||
Default value: `target` | ||
The environemnt variable will be available to use in the comments, it defaults to the task target. | ||
#### options.data | ||
Type: `Object` | ||
Default value: `{environment: target}` | ||
Default value: `{}` | ||
An object `data` that is passed to the `html` file used to compile all template blocks and the entire file if `process` | ||
is true. | ||
If a custom object is passed as `data`, this will be merged with the default to keep the `environment` key intact. | ||
#### options.templateSettings | ||
Type: `Object` | ||
Default value: `null` (Will use default grunt template delimiters `<%` and `%>`) | ||
Default value: `null` (Will use default lodash template delimiters `<%` and `%>`) | ||
Define the `templateSettings` option with a custom `opener` and `closer` delimiters to customize the | ||
template syntax delimiters. | ||
Define the `templateSettings` option with lodash (templateSettings)[http://lodash.com/docs#templateSettings] options to customize the | ||
template syntax. | ||
```javascript | ||
templateSettings: { | ||
opener: '{{', | ||
closer: '}}' | ||
interpolate: /{{([\s\S]+?)}}/g // mustache | ||
} | ||
@@ -415,3 +419,3 @@ ``` | ||
options: { | ||
process: true | ||
process: true, | ||
data: { | ||
@@ -499,2 +503,3 @@ title: 'My app', | ||
## Release History | ||
- 0.3.3 Add [node-htmlprocessor](https://github.com/dciccale/node-htmlprocessor) as a dependency | ||
- 0.3.2 Fix/feature #39 | ||
@@ -501,0 +506,0 @@ - 0.3.1 Fix #35 |
@@ -14,4 +14,3 @@ /* | ||
var utils = require('../lib/utils'); | ||
var HTMLProcessor = require('../lib/htmlprocessor'); | ||
var HTMLProcessor = require('htmlprocessor'); | ||
var path = require('path'); | ||
@@ -29,24 +28,6 @@ | ||
customBlockTypes: [], | ||
}); | ||
// Extend template data with the current target | ||
grunt.util._.extend(options.data, { | ||
environment: this.target | ||
}); | ||
// Set custom delimiters | ||
var templateSettings = options.templateSettings; | ||
if (templateSettings && templateSettings.opener && templateSettings.closer) { | ||
grunt.template.addDelimiters('lodash', templateSettings.opener, templateSettings.closer); | ||
options.delimiters = 'lodash'; | ||
} | ||
// Allow registering custom block types | ||
var customBlockTypes = options.customBlockTypes; | ||
if (customBlockTypes && customBlockTypes.length) { | ||
options.customBlockTypes = customBlockTypes.map(function (processor) { | ||
return path.resolve(processor); | ||
}); | ||
} | ||
var html = new HTMLProcessor(options); | ||
@@ -66,3 +47,3 @@ | ||
if (options.process) { | ||
content = utils.template(content, options); | ||
content = html.template(content, html.data, options.templateSettings); | ||
} | ||
@@ -69,0 +50,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
516
0
16951
2
5
45
1
+ Addedhtmlprocessor@~0.1.0
+ Addedhtmlprocessor@0.1.10(transitive)