New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gulp-processhtml

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-processhtml - npm Package Compare versions

Comparing version
1.1.0
to
1.2.0
+47
.history/index_20171230105625.js
var through = require('through2'),
gutil = require('gulp-util'),
path = require('path'),
HTMLProcessor = require('htmlprocessor'),
PluginError = gutil.PluginError;
module.exports = function(options) {
options = options || {};
if (!options.customBlockTypes) {
options.customBlockTypes = [];
}
// Add some custom block types.
options.customBlockTypes.push(path.join(__dirname, 'custom/replace.js'));
var processor = new HTMLProcessor(options),
content = '';
function processContent(file, enc, cb) {
if (file.isStream()) {
this.emit('error', new PluginError('gulp-processhtml', 'Streams aren\'t supported'));
return cb();
}
if (file.isBuffer()) {
content = processor.processContent(file.contents.toString(enc), file.path);
if (options && options.process) {
content = processor.template(content, processor.data, options.templateSettings);
}
file.contents = new Buffer(content, enc);
}
this.push(file);
cb();
}
return through.obj(processContent);
};
var through = require('through2'),
PluginError = require('plugin-error'),
path = require('path'),
HTMLProcessor = require('htmlprocessor');
module.exports = function(options) {
options = options || {};
if (!options.customBlockTypes) {
options.customBlockTypes = [];
}
// Add some custom block types.
options.customBlockTypes.push(path.join(__dirname, 'custom/replace.js'));
var processor = new HTMLProcessor(options),
content = '';
function processContent(file, enc, cb) {
if (file.isStream()) {
this.emit('error', new PluginError('gulp-processhtml', 'Streams aren\'t supported'));
return cb();
}
if (file.isBuffer()) {
content = processor.processContent(file.contents.toString(enc), file.path);
if (options && options.process) {
content = processor.template(content, processor.data, options.templateSettings);
}
file.contents = new Buffer(content, enc);
}
this.push(file);
cb();
}
return through.obj(processContent);
};
# gulp-processhtml
Gulp plugin uses Denis Ciccale's [node-htmlprocessor](https://github.com/dciccale/node-htmlprocessor)
to process/transform html files.
![Travis](http://img.shields.io/travis/Wildhoney/gulp-processhtml.svg?style=flat)
 
![npm](http://img.shields.io/npm/v/gulp-processhtml.svg?style=flat)
 
![License MIT](http://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)
* **npm:** `npm install gulp-processhtml --save-dev`
## Gulpfile
```js
var gulp = require('gulp'),
processhtml = require('gulp-processhtml')
opts = { /* plugin options */ };
gulp.task('default', function () {
return gulp.src('./*.html')
.pipe(processhtml(opts))
.pipe(gulp.dest('dist'));
});
```
## Example Usage
You might need to change some attributes in your html, when you're releasing
for a different environment.
Using this plugin, you can transform this:
```html
<!DOCTYPE html>
<html>
<head>
<!-- build:css style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- /build -->
</head>
<body>
<!-- build:js app.min.js -->
<script src="app.js"></script>
<!-- /build -->
<!-- build:remove -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
<!-- build:replace 'Goodbye Livereload...' -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
</body>
</html>
```
To this:
```html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.min.css">
</head>
<body>
<script src="app.min.js"></script>
Goodbye Livereload...
</body>
</html>
```
## Credits
[Denis Ciccale](https://twitter.com/dciccale)
# gulp-processhtml
Gulp plugin uses Denis Ciccale's [node-htmlprocessor](https://github.com/dciccale/node-htmlprocessor)
to process/transform html files.
![Travis](http://img.shields.io/travis/Wildhoney/gulp-processhtml.svg?style=flat)
&nbsp;
![npm](http://img.shields.io/npm/v/gulp-processhtml.svg?style=flat)
&nbsp;
![License MIT](http://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)
* **npm:** `npm install gulp-processhtml --save-dev`
## Gulpfile
```js
var gulp = require('gulp'),
processhtml = require('gulp-processhtml')
opts = { /* plugin options */ };
gulp.task('default', function () {
return gulp.src('./*.html')
.pipe(processhtml(opts))
.pipe(gulp.dest('dist'));
});
```
## Example Usage
You might need to change some attributes in your html, when you're releasing
for a different environment.
Using this plugin, you can transform this:
```html
<!DOCTYPE html>
<html>
<head>
<!-- build:css style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- /build -->
</head>
<body>
<!-- build:js app.min.js -->
<script src="app.js"></script>
<!-- /build -->
<!-- build:remove -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
<!-- build:replace 'Goodbye Livereload...' -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
</body>
</html>
```
To this:
```html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.min.css"/>
</head>
<body>
<script src="app.min.js"></script>
Goodbye Livereload...
</body>
</html>
```
## Credits
[Denis Ciccale](https://twitter.com/dciccale)
# gulp-processhtml
Gulp plugin uses Denis Ciccale's [node-htmlprocessor](https://github.com/dciccale/node-htmlprocessor)
to process/transform html files.
![Travis](http://img.shields.io/travis/Wildhoney/gulp-processhtml.svg?style=flat)
&nbsp;
![npm](http://img.shields.io/npm/v/gulp-processhtml.svg?style=flat)
&nbsp;
![License MIT](http://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)
* **npm:** `npm install gulp-processhtml --save-dev`
## Gulpfile
```js
var gulp = require('gulp'),
processhtml = require('gulp-processhtml')
opts = { /* plugin options */ };
gulp.task('default', function () {
return gulp.src('./*.html')
.pipe(processhtml(opts))
.pipe(gulp.dest('dist'));
});
```
## Example Usage
You might need to change some attributes in your html, when you're releasing
for a different environment.
Using this plugin, you can transform this:
```html
<!DOCTYPE html>
<html>
<head>
<!-- build:css style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- /build -->
</head>
<body>
<!-- build:js app.min.js -->
<script src="app.js"></script>
<!-- /build -->
<!-- build:remove -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
<!-- build:replace 'Goodbye Livereload...' -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
</body>
</html>
```
To this:
```html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.min.css">
</head>
<body>
<script src="app.min.js"></script>
Goodbye Livereload...
</body>
</html>
```
## Credits
[Denis Ciccale](https://twitter.com/dciccale)
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.min.css"/>
</head>
<body>
<script src="app.min.js"></script>
</body>
</html>
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.min.css">
</head>
<body>
<script src="app.min.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.min.css"/>
</head>
<body>
<script src="app.min.js"></script>
Goodbye Livereload...
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.min.css">
</head>
<body>
<script src="app.min.js"></script>
Goodbye Livereload...
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<!-- build:css style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- /build -->
</head>
<body>
<!-- build:js app.min.js -->
<script src="app.js"></script>
<!-- /build -->
<!-- build:remove -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
<!-- build:replace 'Goodbye Livereload...' -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
</body>
</html>
(function main() {
var gulp = require('gulp'),
concat = require('gulp-concat'),
processhtml = require('../index.js');
gulp.task('concat', function() {
gulp.src('js/*.js').pipe(concat('all.js')).pipe(gulp.dest(__dirname));
});
gulp.task('processhtml', function() {
gulp.src('index.html').pipe(processhtml()).pipe(gulp.dest(__dirname));
});
gulp.task('default', ['concat', 'processhtml']);
})();
<!DOCTYPE html>
<html>
<head>
<!-- build:js all.js -->
<script type="text/javascript" src="js/first.js"></script>
<script type="text/javascript" src="js/second.js"></script>
<script type="text/javascript" src="js/third.js"></script>
<!-- /build -->
</head>
<body>
</body>
</html>
var First = {};
var Second = {};
var Third = {};
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.min.css">
</head>
<body>
<script src="app.min.js"></script>
Goodbye Livereload...
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<!-- build:css style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- /build -->
</head>
<body>
<!-- build:js app.min.js -->
<script src="app.js"></script>
<!-- /build -->
<!-- build:remove -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
<!-- build:replace 'Goodbye Livereload...' -->
<script src="http://192.168.0.1:35729/livereload.js?snipver=1"></script>
<!-- /build -->
</body>
</html>
+2
-3
var through = require('through2'),
gutil = require('gulp-util'),
PluginError = require('plugin-error'),
path = require('path'),
HTMLProcessor = require('htmlprocessor'),
PluginError = gutil.PluginError;
HTMLProcessor = require('htmlprocessor');

@@ -7,0 +6,0 @@ module.exports = function(options) {

+5
-4
{
"name": "gulp-processhtml",
"version": "1.1.0",
"version": "1.2.0",
"description": "Process html files at build time to modify them as you wish",

@@ -23,4 +23,4 @@ "repository": {

"dependencies": {
"gulp-util": "latest",
"htmlprocessor": "latest",
"plugin-error": "~0.1.2",
"through2": "latest"

@@ -30,2 +30,3 @@ },

"gulp": "^3.8.11",
"gulp-concat": "^2.5.2",
"gulp-cssmin": "^0.1.6",

@@ -35,3 +36,3 @@ "gulp-mocha": "^2.0.0",

"request": "^2.53.0",
"xpath": "0.0.9"
"xpath": "0.0.22"
},

@@ -63,2 +64,2 @@ "author": "Julien Castelain <jcastelain@gmail.com> (http://www.punkscum.org)",

"license": "MIT"
}
}

@@ -78,2 +78,2 @@ # gulp-processhtml

[Denis Ciccale](https://twitter.com/tdecs)
[Denis Ciccale](https://twitter.com/dciccale)

@@ -52,2 +52,6 @@ 'use strict';

it('should parse the example from the readme.md', function (done) {
process('test/fixtures/readme.html', 'test/expected/readme.html', done);
});
});

Sorry, the diff of this file is not supported yet