Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

html-webpack-plugin

Package Overview
Dependencies
Maintainers
2
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-webpack-plugin - npm Package Compare versions

Comparing version
2.0.4
to
2.1.0
+33
-8
index.js

@@ -59,2 +59,4 @@ 'use strict';

var chunks = self.filterChunks(compilation.getStats().toJson(), self.options.chunks, self.options.excludeChunks);
// Sort chunks
chunks = self.sortChunks(chunks, self.options.chunksSortMode);
// Get assets

@@ -295,6 +297,32 @@ var assets = self.htmlWebpackPluginAssets(compilation, chunks);

/**
* Helper to sort chunks
*/
HtmlWebpackPlugin.prototype.sortChunks = function(chunks, sortMode) {
// Sort mode auto by default:
if (typeof sortMode === 'undefined' || sortMode === 'auto') {
return chunks.sort(function orderEntryLast(a, b) {
if (a.entry !== b.entry) {
return b.entry ? 1 : -1;
} else {
return b.id - a.id;
}
});
}
// Disabled sorting:
if (sortMode === 'none') {
return chunks;
}
// Custom function
if (typeof sortMode === 'function') {
return chunks.sort(sortMode);
}
// Invalid sort mode
throw new Error('"' + sortMode + '" is not a valid chunk sort mode');
};
/**
* Return all chunks from the compilation result which match the exclude and include filters
*/
HtmlWebpackPlugin.prototype.filterChunks = function (webpackStatsJson, includedChunks, excludedChunks) {
var chunks = webpackStatsJson.chunks.filter(function(chunk){
return webpackStatsJson.chunks.filter(function(chunk){
var chunkName = chunk.names[0];

@@ -305,2 +333,6 @@ // This chunk doesn't have a name. This script can't handled it.

}
// Skip if the chunk should be lazy loaded
if (!chunk.initial) {
return false;
}
// Skip if the chunks should be filtered and the given chunk was not added explicity

@@ -317,9 +349,2 @@ if (Array.isArray(includedChunks) && includedChunks.indexOf(chunkName) === -1) {

});
return chunks.sort(function orderEntryLast(a, b) {
if (a.entry !== b.entry) {
return b.entry ? 1 : -1;
} else {
return b.id - a.id;
}
});
};

@@ -326,0 +351,0 @@

+2
-1

@@ -0,1 +1,3 @@

'use strict';
var _ = require('lodash');

@@ -5,3 +7,2 @@ var loaderUtils = require('loader-utils');

module.exports = function (source) {
'use strict';
if (this.cacheable) {

@@ -8,0 +9,0 @@ this.cacheable();

{
"name": "html-webpack-plugin",
"version": "2.0.4",
"version": "2.1.0",
"description": "Simplifies creation of HTML files to serve your webpack bundles",

@@ -33,23 +33,24 @@ "main": "index.js",

"devDependencies": {
"appcache-webpack-plugin": "^0.2.0",
"css-loader": "^0.15.4",
"extract-text-webpack-plugin": "^0.8.2",
"appcache-webpack-plugin": "^1.2.1",
"css-loader": "^0.23.0",
"es6-promise": "^3.0.2",
"extract-text-webpack-plugin": "^0.9.1",
"file-loader": "^0.8.4",
"html-loader": "^0.3.0",
"jade-loader": "^0.7.1",
"jade-loader": "^0.8.0",
"jasmine-node": "^1.14.5",
"jshint": "^2.8.0",
"rimraf": "^2.4.1",
"style-loader": "^0.12.3",
"underscore-template-loader": "^0.5.1",
"jshint": "^2.9.1-rc1",
"rimraf": "^2.4.4",
"style-loader": "^0.13.0",
"underscore-template-loader": "^0.5.2",
"url-loader": "^0.5.6",
"webpack": "^1.10.1"
"webpack": "^1.12.8"
},
"dependencies": {
"loader-utils": "^0.2.10",
"loader-utils": "^0.2.11",
"syntax-error": "^1.1.4",
"bluebird": "^2.9.34",
"html-minifier": "^0.7.2",
"lodash": "^3.10.0"
"bluebird": "^3.0.5",
"html-minifier": "^1.0.0",
"lodash": "^3.10.1"
}
}

@@ -72,2 +72,3 @@ HTML Webpack Plugin

- `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk)
- `chunksSortMode`: Allows to controll how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'default' | {function} - default: 'auto'
- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk)

@@ -74,0 +75,0 @@

Change History
==============
v1.4.0
----
* Add `favicon.ico` option
* Add html minifcation
v1.2.0
------
* Set charset using HTML5 meta attribute
* Reload upon change when using webpack watch mode
* Generate manifest attribute when using
[appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin)
* Optionally add webpack hash as a query string to resources included in the HTML
(`hash: true`) for cache busting
* CSS files generated using webpack (for example, by using the
[extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin))
are now automatically included into the generated HTML
* More detailed information about the files generated by webpack is now available
to templates in the `o.htmlWebpackPlugin.files` attribute. See readme for more
details. This new attribute deprecates the old `o.htmlWebpackPlugin.assets` attribute.
* The `templateContent` option can now be a function that returns the template string to use
* Expose webpack configuration to templates (`o.webpackConfig`)
* Sort chunks to honour dependencies between them (useful for use with CommonsChunkPlugin).
The MIT License (MIT)
Copyright (c) 2014 Charles Blaxland
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.