split test htmls to index (for prod test) and dev (for dev)
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>remark42</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 40px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div id="remark42"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var remark_config = {
|
||||
site_id: 'remark',
|
||||
url: 'https://radio-t.com/p/2017/12/16/podcast-576/',
|
||||
};
|
||||
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = '/embed.js';
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -21,5 +21,21 @@
|
||||
<div class="container">
|
||||
<div id="remark42"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var remark_config = {
|
||||
site_id: 'remark',
|
||||
url: 'https://radio-t.com/p/2017/12/16/podcast-576/',
|
||||
};
|
||||
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://demo.remark42.com/web/embed.js';
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by Remark.
|
||||
</noscript>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Test page</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="remark42"></div>
|
||||
<script>
|
||||
var remark_config = {
|
||||
site_id: 'remark',
|
||||
url: 'https://radio-t.com/p/2017/12/16/podcast-576/',
|
||||
};
|
||||
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
// s.src = 'https://demo.remark42.com/web/embed.js';
|
||||
s.src = 'https://demo.remark42.com/web/embed.js';
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by Remark.
|
||||
</noscript>
|
||||
</body>
|
||||
</html>
|
||||
+10
-6
@@ -12,7 +12,6 @@ const Define = webpack.DefinePlugin;
|
||||
const { NODE_ID } = require('./app/common/constants');
|
||||
const publicFolder = path.resolve(__dirname, 'public');
|
||||
const env = process.env.NODE_ENV || 'dev';
|
||||
const hash = env === 'production' ? '' : '.[hash]';
|
||||
|
||||
const commonStyleLoaders = [
|
||||
'css-loader',
|
||||
@@ -40,11 +39,11 @@ module.exports = {
|
||||
context: __dirname,
|
||||
entry: {
|
||||
remark: './app/remark',
|
||||
...(env === 'production' ? { embed: './app/embed' } : {}),
|
||||
embed: './app/embed',
|
||||
},
|
||||
output: {
|
||||
path: publicFolder,
|
||||
filename: `[name]${hash}.js`
|
||||
filename: `[name].js`
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.jsx', '.js'],
|
||||
@@ -99,14 +98,19 @@ module.exports = {
|
||||
new Define({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
}),
|
||||
new Html({ template: path.resolve(__dirname, 'index.ejs') }), // TODO: we should add it only in dev
|
||||
new Html({ template: path.resolve(__dirname, 'index.ejs'), inject: false }), // TODO: we should add it only on demo serv
|
||||
...(env === 'production' ? [] : [new Html({
|
||||
template: path.resolve(__dirname, 'dev.ejs'),
|
||||
filename: 'dev.html',
|
||||
inject: false,
|
||||
})]),
|
||||
new ExtractText({
|
||||
filename: `remark${hash}.css`,
|
||||
filename: `remark.css`,
|
||||
allChunks: true
|
||||
}),
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
...(env === 'production' ? [new webpack.optimize.UglifyJsPlugin()] : []),
|
||||
...(env === 'production' ? [new Copy(['./iframe.html', './test-embed.html'])] : []),
|
||||
new Copy(['./iframe.html']),
|
||||
],
|
||||
watch: env === 'dev',
|
||||
watchOptions: {
|
||||
|
||||
Reference in New Issue
Block a user