Skip to content

Commit e3340b7

Browse files
README add svg-loader
1 parent 40c152a commit e3340b7

File tree

3 files changed

+17
-38
lines changed

3 files changed

+17
-38
lines changed

README.md

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,44 +63,28 @@ with [jade-html-loader](https://github.com/bline/jade-html-loader)
6363

6464
```javascript
6565

66-
module.exports = {
67-
module: {
68-
loaders: [
69-
{
70-
test: /\.html$/,
71-
loader: 'html!posthtml!jade-html'
72-
}
73-
]
74-
},
66+
{ test: /\.jade$/, loader: 'html!posthtml!jade-html' }
67+
```
7568

76-
posthtml: function () {
77-
return {
78-
defaults: [ PostHTML Plugins ]
79-
}
80-
}
81-
}
69+
with [handlebars-loader](https://github.com/altano/handlebars-loader)
70+
71+
```javascript
72+
73+
{ test: /\.hbs$/, loader: 'handlebars!html!posthtml' }
8274
```
8375

8476
with [dom-loader](https://github.com/Wizcorp/dom-loader)
8577

8678
```javascript
8779

88-
module.exports = {
89-
module: {
90-
loaders: [
91-
{
92-
test: /\.html$/,
93-
loader: 'dom!html!posthtml'
94-
}
95-
]
96-
},
80+
{ test: /\.html$/, loader: 'dom!html!posthtml' }
81+
```
9782

98-
posthtml: function () {
99-
return {
100-
defaults: [ PostHTML Plugins ]
101-
}
102-
}
103-
}
83+
with [svg-loader](https://github.com/Wizcorp/dom-loader)
84+
85+
```javascript
86+
87+
{ test: /\.html$/, loader: 'svg!posthtml' }
10488
```
10589

10690
with [extract-text-plugin](https://github.com/webpack/extract-text-webpack-plugin)

index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@ module.exports = function (source) {
2121
plugins = plugins[options.pack]
2222
}
2323
if (typeof plugins === 'undefined' || typeof plugins === 'object') {
24-
plugins = []
24+
plugins = plugins.defaults || []
2525
}
2626

2727
var loader = this
2828
var callback = this.async()
2929

30-
console.log(options)
31-
3230
posthtml(plugins)
3331
.process(source.toString())
34-
.then((result) => {
35-
console.log(result.html)
36-
callback(null, result.html)
37-
})
32+
.then(result => callback(null, result.html))
3833
.catch((error) => {
3934
if (error.name === 'HTML Syntax Error') {
4035
loader.emitError(error.message + error.showSourceCode())

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "posthtml-loader",
3-
"version": "0.0.7",
3+
"version": "0.8.0",
44
"engine": ">=4",
55
"main": "index.js",
66
"dependencies": {

0 commit comments

Comments
 (0)