@@ -9,18 +9,10 @@ Webpack loader for [PostHTML](https://github.com/posthtml/posthtml)
9
9
```
10
10
11
11
## Usage
12
- ### Inline
12
+ ### Setup
13
13
14
14
``` javascript
15
- // file.js
16
-
17
- var html = require (' html!posthtml!./file.html' )
18
- ```
19
-
20
- ### Config
21
-
22
- ``` javascript
23
- // webpack.config.js || webpackfile.js
15
+ // webpack.config.js
24
16
25
17
module: {
26
18
loaders: [
@@ -34,7 +26,7 @@ module: {
34
26
posthtml : function () {
35
27
return {
36
28
defaults: [ PostHTML Plugins ]
37
- // Add Plugin Packs
29
+ // Add our own Plugin Packs
38
30
}
39
31
}
40
32
```
@@ -47,20 +39,94 @@ module.exports = {
47
39
module: {
48
40
loaders: [
49
41
{
50
- test: / \. includes\. html$ / ,
42
+ test: / \. html$ / ,
43
+ loader: ' html!posthtml'
44
+ }
45
+ {
46
+ test: / \. include\. html$ / ,
51
47
loader: ' html!posthtml?pack=includes'
52
- },
48
+ }
49
+ ]
50
+ },
51
+
52
+ posthtml : function () {
53
+ return {
54
+ defaults: [ PostHTML Plugins ],
55
+ includes: [ PostHTML Plugins ]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### Examples
62
+ with [ jade-html-loader] ( https://github.com/bline/jade-html-loader )
63
+
64
+ ``` javascript
65
+
66
+ module .exports = {
67
+ module: {
68
+ loaders: [
53
69
{
54
- test: / \. html$ / ,
55
- loader: ' html!posthtml'
70
+ test: / \. html$ / ,
71
+ loader: ' html!posthtml!jade-html'
72
+ }
73
+ ]
74
+ },
75
+
76
+ posthtml : function () {
77
+ return {
78
+ defaults: [ PostHTML Plugins ]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ with [ dom-loader] ( https://github.com/Wizcorp/dom-loader )
85
+
86
+ ``` javascript
87
+
88
+ module .exports = {
89
+ module: {
90
+ loaders: [
91
+ {
92
+ test: / \. html$ / ,
93
+ loader: ' dom!html!posthtml'
56
94
}
57
95
]
58
96
},
59
97
60
98
posthtml : function () {
61
99
return {
62
- defaults: [PostHTML Plugins],
63
- includes: [PostHTML Plugins]
100
+ defaults: [ PostHTML Plugins ]
64
101
}
102
+ }
103
+ }
104
+ ```
105
+
106
+ with [ extract-text-plugin] ( https://github.com/webpack/extract-text-webpack-plugin )
107
+
108
+ ``` javascript
109
+
110
+ var ExtractText = require (' extract-text-webpack-plugin' )
111
+
112
+ module .exports = {
113
+ module: {
114
+ loaders: [
115
+ {
116
+ test: / \. html$ / ,
117
+ loader: ExtractText .extract (' html!posthtml' )
118
+ }
119
+ ]
120
+ },
121
+
122
+ posthtml : function () {
123
+ return {
124
+ defaults: [ PostHTML Plugins ]
125
+ }
126
+ },
127
+
128
+ plugins: [
129
+ new ExtractText (' output.html' )
130
+ ]
65
131
}
66
132
```
0 commit comments