Skip to content

Commit cce5ef6

Browse files
committed
change name, config field, readme
1 parent 6c84fae commit cce5ef6

File tree

3 files changed

+28
-50
lines changed

3 files changed

+28
-50
lines changed

README.md

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
# html loader for webpack
1+
# vue-html-loader
2+
3+
> This is a fork of [html-loader](https://github.com/webpack/html-loader) with some modifications for handling Vue templates.
4+
5+
## Config
6+
7+
You can config the loader's behavior by adding an `html` field under `vue` in your webpack config:
8+
9+
``` js
10+
// webpack.config.js
11+
module.exports = {
12+
// ...
13+
vue: {
14+
html: {
15+
// all loader queries can be specified here
16+
// also, you can specify options for htmlMinifier here.
17+
}
18+
}
19+
}
20+
```
21+
22+
## Original README below
223

324
Exports HTML as string. HTML is minimized when the compiler demands.
425

@@ -87,46 +108,6 @@ require("html?interpolate!./file.html");
87108
<div>${require('./partials/gallery.html')}</div>
88109
```
89110

90-
## Advanced options
91-
92-
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`:
93-
94-
``` javascript
95-
module.exports = {
96-
...
97-
module: {
98-
loaders: [
99-
{
100-
test: /\.html$/,
101-
loader: "html"
102-
}
103-
]
104-
}
105-
htmlLoader: {
106-
ignoreCustomFragments: [/\{\{.*?}}/]
107-
}
108-
};
109-
```
110-
111-
If you need to define two different loader configs, you can also change the config's property name via `html?config=otherHtmlLoaderConfig`:
112-
113-
```javascript
114-
module.exports = {
115-
...
116-
module: {
117-
loaders: [
118-
{
119-
test: /\.html$/,
120-
loader: "html?config=otherHtmlLoaderConfig"
121-
}
122-
]
123-
}
124-
otherHtmlLoaderConfig: {
125-
...
126-
}
127-
};
128-
```
129-
130111
## License
131112

132113
MIT (http://www.opensource.org/licenses/mit-license.php)

index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ function randomIdent() {
1515

1616
function getLoaderConfig(context) {
1717
var query = loaderUtils.parseQuery(context.query);
18-
var configKey = query.config || 'htmlLoader';
19-
var config = context.options && context.options.hasOwnProperty(configKey) ? context.options[configKey] : {};
20-
18+
var config = (context.options && context.options.vue && context.options.vue.html) || {};
2119
delete query.config;
22-
2320
return assign(query, config);
2421
}
2522

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "html-loader",
3-
"version": "0.4.3",
4-
"author": "Tobias Koppers @sokra",
5-
"description": "html loader module for webpack",
2+
"name": "vue-html-loader",
3+
"version": "1.2.0",
4+
"author": "Evan You",
5+
"description": "vue template loader for webpack",
66
"dependencies": {
77
"es6-templates": "^0.2.2",
88
"fastparse": "^1.0.0",
@@ -19,7 +19,7 @@
1919
},
2020
"repository": {
2121
"type": "git",
22-
"url": "git@github.com:webpack/html-loader.git"
22+
"url": "git@github.com:vuejs/vue-html-loader.git"
2323
},
2424
"licenses": [
2525
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy