Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 4 support added #38

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ HtmlWebpackInlineSourcePlugin.prototype.apply = function (compiler) {
var self = this;

// Hook into the html-webpack-plugin processing
compiler.plugin('compilation', function (compilation) {
compilation.plugin('html-webpack-plugin-alter-asset-tags', function (htmlPluginData, callback) {
compiler.hooks.compilation.tap('html-webpack-inline-source-plugin', function (compilation) {
compilation.hooks.htmlWebpackPluginAlterAssetTags.tapAsync('html-webpack-inline-source-plugin', function (htmlPluginData, callback) {
// Skip if the plugin configuration didn't set `inlineSource`
if (!htmlPluginData.plugin.options.inlineSource) {
return callback(null, htmlPluginData);
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
},
"homepage": "https://github.com/dustinjackson/html-webpack-inline-source-plugin",
"devDependencies": {
"cheerio": "^0.22.0",
"css-loader": "^0.25.0",
"extract-text-webpack-plugin": "^1.0.1",
"html-webpack-plugin": "^2.16.0",
"jasmine": "^2.4.1",
"cheerio": "^1.0.0-rc.2",
"css-loader": "^0.28.10",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"html-webpack-plugin": "^3.0.1",
"jasmine": "^3.1.0",
"rimraf": "^2.5.2",
"semistandard": "^7.0.5",
"style-loader": "^0.13.1",
"webpack": "^1.13.0"
"style-loader": "^0.20.2",
"webpack": "^4.0.1"
},
"dependencies": {
"escape-string-regexp": "^1.0.5",
Expand Down
10 changes: 5 additions & 5 deletions spec/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('HtmlWebpackInlineSourcePlugin', function () {
path: OUTPUT_DIR
},
module: {
loaders: [{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }]
rules: [{ test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) }]
},
plugins: [
new ExtractTextPlugin('style.css'),
Expand All @@ -35,7 +35,7 @@ describe('HtmlWebpackInlineSourcePlugin', function () {
fs.readFile(htmlFile, 'utf8', function (er, data) {
expect(er).toBeFalsy();
var $ = cheerio.load(data);
expect($('script[src="bundle.js"]').html()).toBe('');
expect($('script[src="main.js"]').html()).toBe('');
expect($('link[href="style.css"]').html()).toBe('');
done();
});
Expand All @@ -54,7 +54,7 @@ describe('HtmlWebpackInlineSourcePlugin', function () {
path: OUTPUT_DIR
},
module: {
loaders: [{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }]
rules: [{ test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) }]
},
// generate sourcemaps for testing URL correction
devtool: '#source-map',
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('HtmlWebpackInlineSourcePlugin', function () {
path: OUTPUT_DIR
},
module: {
loaders: [{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }]
rules: [{ test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) }]
},
plugins: [
new ExtractTextPlugin('style.css?[hash]'),
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('HtmlWebpackInlineSourcePlugin', function () {
path: OUTPUT_DIR
},
module: {
loaders: [{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }]
rules: [{ test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) }]
},
plugins: [
new ExtractTextPlugin('style.css'),
Expand Down