Skip to content
Merged
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
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"copy-webpack-plugin": "^4.5.3",
"cross-env": "^5.2.0",
"css-loader": "^0.28.11",
"ejs": "^2.6.1",
"file-loader": "^1.1.11",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.9.3",
Expand Down
3 changes: 3 additions & 0 deletions template/src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<meta charset="UTF-8">
<title>{{ name }} - Options</title>
<link rel="stylesheet" href="options.css">
<% if (NODE_ENV === 'development') { %>
<!-- Load some resources only in development environment -->
<% } %>
</head>
<body>
<div id="app"></div>
Expand Down
3 changes: 3 additions & 0 deletions template/src/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="popup.css">
<% if (NODE_ENV === 'development') { %>
<!-- Load some resources only in development environment -->
<% } %>
</head>
<body>
<div id="app">
Expand Down
11 changes: 9 additions & 2 deletions template/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const webpack = require('webpack');
const ejs = require('ejs');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WebpackShellPlugin = require('webpack-shell-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
Expand Down Expand Up @@ -60,8 +61,8 @@ const config = {
}),
new CopyWebpackPlugin([
{ from: 'icons', to: 'icons', ignore: ['icon.xcf'] },
{ from: 'popup/popup.html', to: 'popup/popup.html' },{{#options}}
{ from: 'options/options.html', to: 'options/options.html' },{{/options}}
{ from: 'popup/popup.html', to: 'popup/popup.html', transform: transformHtml },{{#options}}
{ from: 'options/options.html', to: 'options/options.html', transform: transformHtml },{{/options}}
{
from: 'manifest.json',
to: 'manifest.json',
Expand Down Expand Up @@ -99,4 +100,10 @@ if (process.env.HMR === 'true') {
]);
}

function transformHtml(content) {
return ejs.render(content.toString(), {
...process.env,
});
}

module.exports = config;