diff --git a/README.md b/README.md
index 262372ca..97ca5480 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,31 @@
-# html loader for webpack
+# DEPRECATED
+
+This is only used by the now outdated 8.x version of vue-loader.
+
+---
+
+# vue-html-loader
+
+> This is a fork of [html-loader](https://github.com/webpack/html-loader) with some modifications for handling Vue templates.
+
+## Config
+
+You can config the loader's behavior by adding an `html` field under `vue` in your webpack config:
+
+``` js
+// webpack.config.js
+module.exports = {
+ // ...
+ vue: {
+ html: {
+ // all loader queries can be specified here
+ // also, you can specify options for htmlMinifier here.
+ }
+ }
+}
+```
+
+## Original README below
Exports HTML as string. HTML is minimized when the compiler demands.
@@ -87,46 +114,6 @@ require("html?interpolate!./file.html");
${require('./partials/gallery.html')}
```
-## Advanced options
-
-If you need to pass [more advanced options](https://github.com/webpack/html-loader/pull/46), especially those which cannot be stringified, you can also define an `htmlLoader`-property on your `webpack.config.js`:
-
-``` javascript
-module.exports = {
- ...
- module: {
- loaders: [
- {
- test: /\.html$/,
- loader: "html"
- }
- ]
- }
- htmlLoader: {
- ignoreCustomFragments: [/\{\{.*?}}/]
- }
-};
-```
-
-If you need to define two different loader configs, you can also change the config's property name via `html?config=otherHtmlLoaderConfig`:
-
-```javascript
-module.exports = {
- ...
- module: {
- loaders: [
- {
- test: /\.html$/,
- loader: "html?config=otherHtmlLoaderConfig"
- }
- ]
- }
- otherHtmlLoaderConfig: {
- ...
- }
-};
-```
-
## License
MIT (http://www.opensource.org/licenses/mit-license.php)
diff --git a/index.js b/index.js
index d751899d..c111f499 100644
--- a/index.js
+++ b/index.js
@@ -14,12 +14,9 @@ function randomIdent() {
}
function getLoaderConfig(context) {
- var query = loaderUtils.parseQuery(context.query);
- var configKey = query.config || 'htmlLoader';
- var config = context.options && context.options.hasOwnProperty(configKey) ? context.options[configKey] : {};
-
+ var query = loaderUtils.getOptions(context) || {};
+ var config = (context.options && context.options.vue && context.options.vue.html) || {};
delete query.config;
-
return assign(query, config);
}
@@ -77,10 +74,8 @@ module.exports = function(content) {
"removeAttributeQuotes",
"useShortDoctype",
"keepClosingSlash",
- "minifyJS",
- "minifyCSS",
"removeScriptTypeAttributes",
- "removeStyleTypeAttributes",
+ "removeStyleLinkTypeAttributes"
].forEach(function(name) {
if(typeof minimizeOptions[name] === "undefined") {
minimizeOptions[name] = true;
diff --git a/lib/attributesParser.js b/lib/attributesParser.js
index ff49026f..22589c63 100644
--- a/lib/attributesParser.js
+++ b/lib/attributesParser.js
@@ -27,9 +27,9 @@ var parser = new Parser({
inside: {
"\\s+": true, // eat up whitespace
">": "outside", // end of attributes
- "(([0-9a-zA-Z\\-:]+)\\s*=\\s*\")([^\"]*)\"": processMatch,
- "(([0-9a-zA-Z\\-:]+)\\s*=\\s*\')([^\']*)\'": processMatch,
- "(([0-9a-zA-Z\\-:]+)\\s*=\\s*)([^\\s>]+)": processMatch
+ "(([0-9a-zA-Z\\-:\.]+)\\s*=\\s*\")([^\"]*)\"": processMatch,
+ "(([0-9a-zA-Z\\-:\.]+)\\s*=\\s*\')([^\']*)\'": processMatch,
+ "(([0-9a-zA-Z\\-:\.]+)\\s*=\\s*)([^\\s>]+)": processMatch
}
});
diff --git a/package.json b/package.json
index 0389d29e..3c0199a6 100644
--- a/package.json
+++ b/package.json
@@ -1,30 +1,25 @@
{
- "name": "html-loader",
- "version": "0.4.3",
- "author": "Tobias Koppers @sokra",
- "description": "html loader module for webpack",
+ "name": "vue-html-loader",
+ "version": "1.2.4",
+ "author": "Evan You",
+ "description": "vue template loader for webpack",
"dependencies": {
"es6-templates": "^0.2.2",
"fastparse": "^1.0.0",
- "html-minifier": "^1.0.0",
- "loader-utils": "~0.2.2",
- "object-assign": "^4.0.1"
+ "html-minifier": "^2.1.5",
+ "loader-utils": "^1.0.2",
+ "object-assign": "^4.1.0"
},
"devDependencies": {
"mocha": "^2.3.4",
- "should": "^7.1.1"
+ "should": "^9.0.2"
},
"scripts": {
"test": "mocha --reporter spec"
},
"repository": {
"type": "git",
- "url": "git@github.com:webpack/html-loader.git"
+ "url": "git@github.com:vuejs/vue-html-loader.git"
},
- "licenses": [
- {
- "type": "MIT",
- "url": "http://www.opensource.org/licenses/mit-license.php"
- }
- ]
+ "license": "MIT"
}
diff --git a/test/loaderTest.js b/test/loaderTest.js
index cb024368..faf5f6fd 100644
--- a/test/loaderTest.js
+++ b/test/loaderTest.js
@@ -38,7 +38,7 @@ describe("loader", function() {
loader.call({
minimize: true
}, '