From 45f6557c7d1be3c7001919f327d32e7930473fd6 Mon Sep 17 00:00:00 2001
From: EGOIST <0x142857@gmail.com>
Date: Thu, 4 Feb 2016 23:48:34 +0800
Subject: [PATCH] feat(webpack): use jade as default template engine
---
lib/index.html | 20 --------------------
lib/index.jade | 15 +++++++++++++++
lib/webpack.config.base.js | 6 +++++-
package.json | 8 +++++---
4 files changed, 25 insertions(+), 24 deletions(-)
delete mode 100644 lib/index.html
create mode 100644 lib/index.jade
diff --git a/lib/index.html b/lib/index.html
deleted file mode 100644
index d670b9d..0000000
--- a/lib/index.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
- {%=o.htmlWebpackPlugin.options.title || 'Webpack App'%}
- {% if (o.htmlWebpackPlugin.files.favicon) { %}
-
- {% } %}
- {% for (var css in o.htmlWebpackPlugin.files.css) { %}
-
- {% } %}
-
-
-
- {% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}
-
- {% } %}
-
-
\ No newline at end of file
diff --git a/lib/index.jade b/lib/index.jade
new file mode 100644
index 0000000..0c0ef07
--- /dev/null
+++ b/lib/index.jade
@@ -0,0 +1,15 @@
+doctype html
+html
+ head
+ meta(charset="utf-8")
+ meta(name="viewport" content="width=device-width, initial-scale=1")
+ meta(http-equiv="X-UA-Compatible" content="IE=edge,chrome=1")
+ title= htmlWebpackPlugin.options.title
+ if htmlWebpackPlugin.files.favicon
+ link(rel="shortcut icon" href=htmlWebpackPlugin.files.favicon)
+ each css in htmlWebpackPlugin.files.css
+ link(rel="stylesheet" href=css)
+ body
+ app
+ each js in htmlWebpackPlugin.files.js
+ script(src=js)
diff --git a/lib/webpack.config.base.js b/lib/webpack.config.base.js
index 105d019..a320ea0 100644
--- a/lib/webpack.config.base.js
+++ b/lib/webpack.config.base.js
@@ -72,6 +72,10 @@ module.exports = function (type, options) {
test: /\.(png|jpg|gif)$/,
loader: 'url?limit=1000&name=images/[hash].[ext]',
exclude: [/node_modules/]
+ },
+ {
+ test: /\.jade$/,
+ loaders: ['jade']
}
]
},
@@ -91,7 +95,7 @@ module.exports = function (type, options) {
plugins: [
new HtmlWebpackPlugin(Object.assign({}, {
title: 'Tooling',
- template: dir('lib/index.html')
+ template: dir('lib/index.jade')
}, toolingConfig.index))
]
}
diff --git a/package.json b/package.json
index cbb3d8b..38451c7 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,9 @@
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^0.9.1",
"file-loader": "^0.8.5",
- "html-webpack-plugin": "^1.7.0",
+ "html-webpack-plugin": "^2.8.1",
+ "jade": "^1.11.0",
+ "jade-loader": "^0.8.0",
"json-loader": "^0.5.4",
"npm-install-webpack-plugin": "^2.0.0",
"object-string": "0.0.1",
@@ -69,7 +71,7 @@
"vue-hot-reload-api": "^1.2.2",
"vue-html-loader": "^1.0.0",
"vue-loader": "^7.5.0",
- "webpack": "^1.12.9",
+ "webpack": "^1.12.13",
"webpack-hot-server": "^0.1.1"
},
"devDependencies": {
@@ -80,7 +82,7 @@
"tooling": {
"index": {
"title": "tooling index",
- "template": "example/index.template"
+ "template": "lib/index.jade"
}
},
"config": {