summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYukai Huang2016-11-02 18:01:26 +0800
committerYukai Huang2016-11-02 18:01:26 +0800
commitf1f8846b0adc6dd330286d2edeb399215530a391 (patch)
tree5f0bc5672978798f921a6edf01ac5bba7e1f8574
parent3e23009663d72526f393348f91e45fde93f67236 (diff)
Config extra entry for html.min.css
Diffstat (limited to '')
-rw-r--r--public/js/extra.js2
-rw-r--r--public/js/htmlExport.js5
-rw-r--r--webpack.config.js29
-rw-r--r--webpack.production.js33
4 files changed, 64 insertions, 5 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 01363886..81dd4a28 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -588,7 +588,7 @@ function exportToHTML(view) {
var tocAffix = $('#ui-toc-affix').clone();
tocAffix.find('*').removeClass('active').find("a[href^='#'][smoothhashscroll]").removeAttr('smoothhashscroll');
//generate html via template
- $.get(serverurl + '/css/html.min.css', function (css) {
+ $.get(serverurl + '/build/html.min.css', function (css) {
$.get(serverurl + '/views/html.hbs', function (data) {
var template = Handlebars.compile(data);
var context = {
diff --git a/public/js/htmlExport.js b/public/js/htmlExport.js
new file mode 100644
index 00000000..e9fc41c6
--- /dev/null
+++ b/public/js/htmlExport.js
@@ -0,0 +1,5 @@
+require('../css/github-extract.css');
+require('../css/markdown.css');
+require('../css/extra.css');
+require('../css/slide-preview.css');
+require('../css/site.css');
diff --git a/webpack.config.js b/webpack.config.js
index 6a436f43..f9d9a6db 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,8 +1,33 @@
var baseConfig = require('./webpackBaseConfig');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
+var path = require('path');
-module.exports = Object.assign({}, baseConfig, {
+module.exports = [Object.assign({}, baseConfig, {
plugins: baseConfig.plugins.concat([
new ExtractTextPlugin("[name].css")
])
-});
+}), {
+ entry: {
+ htmlExport: path.join(__dirname, 'public/js/htmlExport.js')
+ },
+ module: {
+ loaders: [{
+ test: /\.css$/,
+ loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
+ }, {
+ test: /\.scss$/,
+ loader: ExtractTextPlugin.extract('style-loader', 'sass-loader')
+ }, {
+ test: /\.less$/,
+ loader: ExtractTextPlugin.extract('style-loader', 'less-loader')
+ }]
+ },
+ output: {
+ path: path.join(__dirname, 'public/build'),
+ publicPath: '/build/',
+ filename: '[name].js'
+ },
+ plugins: [
+ new ExtractTextPlugin("html.min.[hash].css")
+ ]
+}];
diff --git a/webpack.production.js b/webpack.production.js
index 1a55e615..a4dfd248 100644
--- a/webpack.production.js
+++ b/webpack.production.js
@@ -3,7 +3,7 @@ var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
-module.exports = Object.assign({}, baseConfig, {
+module.exports = [Object.assign({}, baseConfig, {
plugins: baseConfig.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
@@ -25,4 +25,33 @@ module.exports = Object.assign({}, baseConfig, {
publicPath: '/build/',
filename: '[id].[name].[hash].js'
}
-});
+}), {
+ entry: {
+ htmlExport: path.join(__dirname, 'public/js/htmlExport.js')
+ },
+ module: {
+ loaders: [{
+ test: /\.css$/,
+ loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
+ }, {
+ test: /\.scss$/,
+ loader: ExtractTextPlugin.extract('style-loader', 'sass-loader')
+ }, {
+ test: /\.less$/,
+ loader: ExtractTextPlugin.extract('style-loader', 'less-loader')
+ }]
+ },
+ output: {
+ path: path.join(__dirname, 'public/build'),
+ publicPath: '/build/',
+ filename: '[name].js'
+ },
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env': {
+ 'NODE_ENV': JSON.stringify('production')
+ }
+ }),
+ new ExtractTextPlugin("html.min.css")
+ ]
+}];