From f651a826d8137af475e75b6b40da6726b0a006a7 Mon Sep 17 00:00:00 2001 From: abhijithvijayan <34790378+abhijithvijayan@users.noreply.github.com> Date: Mon, 27 Jan 2020 19:21:43 +0530 Subject: [PATCH] refactor: move views html around --- {src => views}/options.html | 5 +++-- {src => views}/popup.html | 7 ++++--- webpack.config.js | 17 +++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) rename {src => views}/options.html (82%) rename {src => views}/popup.html (62%) diff --git a/src/options.html b/views/options.html similarity index 82% rename from src/options.html rename to views/options.html index a814d56..4bf4fa7 100644 --- a/src/options.html +++ b/views/options.html @@ -6,6 +6,7 @@ Options - - + +
+ diff --git a/src/popup.html b/views/popup.html similarity index 62% rename from src/popup.html rename to views/popup.html index ce1bb49..a162442 100644 --- a/src/popup.html +++ b/views/popup.html @@ -2,10 +2,11 @@ - + Popup - - + + + diff --git a/webpack.config.js b/webpack.config.js index 20f7019..a4ec8e9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,6 +12,7 @@ const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries'); const manifestInput = require('./src/manifest'); +const viewsPath = path.join(__dirname, 'views'); const nodeEnv = process.env.NODE_ENV || 'development'; const targetBrowser = process.env.TARGET_BROWSER; const manifest = wextManifest[targetBrowser](manifestInput); @@ -125,17 +126,17 @@ module.exports = { verbose: true, }), new HtmlWebpackPlugin({ - template: 'src/options.html', - // inject: false, - chunks: ['options'], - filename: 'options.html', - }), - new HtmlWebpackPlugin({ - template: 'src/popup.html', - // inject: false, + template: path.join(viewsPath, 'popup.html'), + inject: 'body', chunks: ['popup'], filename: 'popup.html', }), + new HtmlWebpackPlugin({ + template: path.join(viewsPath, 'options.html'), + inject: 'body', + chunks: ['options'], + filename: 'options.html', + }), new CopyWebpackPlugin([{ from: 'src/assets', to: 'assets' }]), new WriteWebpackPlugin([{ name: manifest.name, data: Buffer.from(manifest.content) }]), extensionReloaderPlugin,