refactor: move views html around

This commit is contained in:
abhijithvijayan 2020-01-27 19:21:43 +05:30
parent 87e6f427de
commit f651a826d8
3 changed files with 16 additions and 13 deletions

View File

@ -6,6 +6,7 @@
<title>Options</title> <title>Options</title>
<link rel="stylesheet" href="css/options.css" /> <link rel="stylesheet" href="css/options.css" />
</head> </head>
<body>
<body></body> <div id="options-root"></div>
</body>
</html> </html>

View File

@ -2,10 +2,11 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=500" />
<title>Popup</title> <title>Popup</title>
<link rel="stylesheet" href="css/popup.css" /> <link rel="stylesheet" href="css/popup.css" />
</head> </head>
<body>
<body></body> <div id="popup-root"></div>
</body>
</html> </html>

View File

@ -12,6 +12,7 @@ const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
const manifestInput = require('./src/manifest'); const manifestInput = require('./src/manifest');
const viewsPath = path.join(__dirname, 'views');
const nodeEnv = process.env.NODE_ENV || 'development'; const nodeEnv = process.env.NODE_ENV || 'development';
const targetBrowser = process.env.TARGET_BROWSER; const targetBrowser = process.env.TARGET_BROWSER;
const manifest = wextManifest[targetBrowser](manifestInput); const manifest = wextManifest[targetBrowser](manifestInput);
@ -125,17 +126,17 @@ module.exports = {
verbose: true, verbose: true,
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'src/options.html', template: path.join(viewsPath, 'popup.html'),
// inject: false, inject: 'body',
chunks: ['options'],
filename: 'options.html',
}),
new HtmlWebpackPlugin({
template: 'src/popup.html',
// inject: false,
chunks: ['popup'], chunks: ['popup'],
filename: 'popup.html', 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 CopyWebpackPlugin([{ from: 'src/assets', to: 'assets' }]),
new WriteWebpackPlugin([{ name: manifest.name, data: Buffer.from(manifest.content) }]), new WriteWebpackPlugin([{ name: manifest.name, data: Buffer.from(manifest.content) }]),
extensionReloaderPlugin, extensionReloaderPlugin,