Socket
Socket
Sign inDemoInstall

extract-text-webpack-plugin

Package Overview
Dependencies
206
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.4 to 0.2.5

2

example/webpack.config.js

@@ -16,4 +16,4 @@ var ExtractTextPlugin = require("../");

plugins: [
new ExtractTextPlugin("styles.css")
new ExtractTextPlugin("styles-[hash]-[chunkhash]-[name].css")
]
};

@@ -80,6 +80,7 @@ /*

}.bind(this));
var texts;
var filename = this.filename;
var id = this.id;
compilation.plugin("optimize-tree", function(chunks, modules, callback) {
var texts = {};
texts = [];
async.forEach(chunks, function(chunk, callback) {

@@ -105,7 +106,7 @@ var shouldExtract = !!(options.allChunks || chunk.initial);

}
text.push(meta.text);
if(meta.text) text.push(meta.text);
callback();
});
} else {
text.push(meta.text);
if(meta.text) text.push(meta.text);
callback();

@@ -117,4 +118,6 @@ }

if(text.length > 0) {
var file = filename.replace(Template.REGEXP_NAME, chunk.name);
texts[file] = (texts[file] || []).concat(text);
texts.push({
chunk: chunk,
text: text
});
}

@@ -125,10 +128,22 @@ callback();

if(err) return callback(err);
Object.keys(texts).forEach(function(file) {
var text = texts[file].join("");
this.assets[file] = new RawSource(text);
}.bind(this));
callback();
}.bind(this));
});
compilation.plugin("additional-assets", function(callback) {
var assetContents = {};
texts.forEach(function(item) {
var chunk = item.chunk;
var file = filename
.replace(Template.REGEXP_NAME, chunk.name || chunk.id)
.replace(Template.REGEXP_HASH, compilation.hash)
.replace(Template.REGEXP_CHUNKHASH, chunk.renderedHash);
assetContents[file] = (assetContents[file] || []).concat(item.text);
});
Object.keys(assetContents).forEach(function(file) {
var text = assetContents[file].join("");
this.assets[file] = new RawSource(text);
}.bind(this));
callback();
});
}.bind(this));
};
{
"name": "extract-text-webpack-plugin",
"version": "0.2.4",
"version": "0.2.5",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "Extract text from bundle into a file.",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc