Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

brfs-htmlmin

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brfs-htmlmin - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

.eslintrc

2

example/bundle.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var html = "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <title>A RMScreenprint</title>\r\n</head>\r\n<body>\r\n <h1>Main heading in my document</h1>\r\n <!-- Note that it is \"h\" + \"1\", not \"h\" + the letters \"one\" -->\r\n <p>Look Ma, I am coding <abbr title=\"Hyper Text Markup Language\">HTML</abbr>.</p>\r\n</body>\r\n</html>";
var html = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <title>A RMScreenprint</title>\n</head>\n<body>\n <h1>Main heading in my document</h1>\n <!-- Note that it is \"h\" + \"1\", not \"h\" + the letters \"one\" -->\n <p>Look Ma, I am coding <abbr title=\"Hyper Text Markup Language\">HTML</abbr>.</p>\n</body>\n</html>";
console.log(html);
},{}]},{},[1]);

@@ -0,1 +1,2 @@

'use strict';
var staticModule = require('static-module');

@@ -7,2 +8,3 @@ var quote = require('quote-stream');

var minify = require('html-minifier').minify;
var defaults = require('lodash.defaults');

@@ -20,3 +22,4 @@ var regexps = [

opts = opts || {};
opts.minify = opts.minify || {
var optsMinify = defaults(opts.minify || {}, {
removeComments: true,

@@ -28,8 +31,8 @@ collapseWhitespace: true,

removeEmptyAttributes: true
};
});
Object.keys(opts.minify).forEach(function (key) {
Object.keys(optsMinify).forEach(function(key) {
if(~regexps.indexOf(key)) {
var value = opts.minify[key];
opts.minify[key] = Array.isArray(value) ?
var value = optsMinify[key];
optsMinify[key] = Array.isArray(value) ?
value.map(asRegExp) :

@@ -44,6 +47,9 @@ asRegExp(value);

};
if(opts.vars) Object.keys(opts.vars).forEach(function (key) {
vars[key] = opts.vars[key];
});
if(opts.vars) {
Object.keys(opts.vars).forEach(function(key) {
vars[key] = opts.vars[key];
});
}
var sm = staticModule(

@@ -60,18 +66,18 @@ {

function readFileSync(file, enc) {
enc = enc || 'utf8';
function readFileSync(fileRead, encoding) {
encoding = encoding || 'utf8';
var bufArr = [];
return fs.createReadStream(file, { encoding: enc })
return fs.createReadStream(fileRead, { encoding: encoding })
.pipe(through(write, end))
.pipe(quote());
function write (buf, enc, next) {
function write(buf, enc, next) {
bufArr.push(buf);
next();
}
function end (next) {
if(/\.html$/.test(file)) {
this.push(minify(bufArr.toString('utf8'), opts.minify));
function end(next) {
if(/\.html$/.test(fileRead)) {
this.push(minify(bufArr.toString('utf8'), optsMinify));
}

@@ -82,3 +88,3 @@ else {

this.push(null);
sm.emit('file', file);
sm.emit('file', fileRead);
next();

@@ -85,0 +91,0 @@ }

{
"name": "brfs-htmlmin",
"version": "1.1.0",
"version": "2.0.0",
"description": "browserify fs.readFileSync() static html file inliner with html minifier",

@@ -30,2 +30,3 @@ "main": "index.js",

"html-minifier": "^0.7.2",
"lodash.defaults": "^3.1.2",
"quote-stream": "0.0.0",

@@ -32,0 +33,0 @@ "static-module": "^1.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc