You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -92,8 +92,32 @@ You can also include Webpack loader queries in the `lang` attribute:
92
92
93
93
For template pre-processors, you should install `template-html-loader` plus the raw templating engine. For example to use `jade`, you will need to install both `template-html-loader` and `jade` instead of `jade-loader`.
94
94
95
+
## Style Imports
96
+
97
+
If you want, you can separate your styles into a separate file and import it using the `src` attribute:
98
+
99
+
```html
100
+
<stylesrc="./style.css"></style>
101
+
```
102
+
103
+
Beware that `src` imports follow similar rules to `require()` calls, which means for relative paths you need to start with `./`, and you can import resources from node modules: `<style src="todomvc-app-css/index.css">`.
104
+
105
+
## Asset URL Handling
106
+
107
+
By default, `vue-loader` automatically processes your style and template files with `css-loader` and `vue-html-loader` - this means that all asset URLs such as `<img src="...">`, `background: url(...)` and CSS `@import` are **resolved as module dependencies**.
108
+
109
+
For example, `url(image.png)` will be translated into `require('./image.png')`. Because `.png` is not JavaScript, you will need to configure Webpack to use [file-loader](https://github.com/webpack/file-loader) or [url-loader](https://github.com/webpack/url-loader) to handle them. This may feel cumbersome, but it gives you some very powerful benefits in managing your static assets this way:
110
+
111
+
1.`file-loader` allows you to customize where to copy and place the asset file (by specifying `publicPath` in your Webpack config), and how they should be named with version hashes.
112
+
113
+
2.`url-loader` allows you to conditionally load a file as a inline Data URL if they are smaller than a given threshold.
114
+
115
+
For more details, see the respective documentations for [vue-html-loader](https://github.com/vuejs/vue-html-loader) and [css-loader](https://github.com/webpack/css-loader).
116
+
95
117
## Scoped Styles
96
118
119
+
> Experimental
120
+
97
121
When a `<style>` tag has the `scoped` attribute, its CSS will apply to elements of the current component only. This is similar to the style encapsulation found in Shadow DOM, but doesn't require any polyfills. It is achieved by transforming the following:
98
122
99
123
```html
@@ -130,6 +154,8 @@ Into the following:
130
154
131
155
## Hot Reload
132
156
157
+
> Experimental
158
+
133
159
When using `webpack-dev-server` in hot mode, `vue-loader` enables hot component reloading for Vue.js 1.0.0+. An example config:
134
160
135
161
```js
@@ -164,28 +190,6 @@ Finally, visit `http://localhost:8080/webpack-dev-server/` to see the app with h
164
190
165
191
For a complete example with hot reloading in action, see [vue-hackernews](https://github.com/vuejs/vue-hackernews).
166
192
167
-
## Style Imports
168
-
169
-
If you want, you can separate your styles into a separate file and import it using the `src` attribute:
170
-
171
-
```html
172
-
<stylesrc="./style.css"></style>
173
-
```
174
-
175
-
Beware that `src` imports follow similar rules to `require()` calls, which means for relative paths you need to start with `./`, and you can import resources from node modules: `<style src="todomvc-app-css/index.css">`.
176
-
177
-
## Asset URL Handling
178
-
179
-
By default, `vue-loader` automatically processes your style and template files with `css-loader` and `vue-html-loader` - this means that all asset URLs such as `<img src="...">`, `background: url(...)` and CSS `@import` are **resolved as module dependencies**.
180
-
181
-
For example, `url(image.png)` will be translated into `require('./image.png')`. Because `.png` is not JavaScript, you will need to configure Webpack to use [file-loader](https://github.com/webpack/file-loader) or [url-loader](https://github.com/webpack/url-loader) to handle them. This may feel cumbersome, but it gives you some very powerful benefits in managing your static assets this way:
182
-
183
-
1.`file-loader` allows you to customize where to copy and place the asset file (by specifying `publicPath` in your Webpack config), and how they should be named with version hashes.
184
-
185
-
2.`url-loader` allows you to conditionally load a file as a inline Data URL if they are smaller than a given threshold.
186
-
187
-
For more details, see the respective documentations for [vue-html-loader](https://github.com/vuejs/vue-html-loader) and [css-loader](https://github.com/webpack/css-loader).
188
-
189
193
## Advanced Loader configuration
190
194
191
195
By default, `vue-loader` will try to use the loader with the same name as
0 commit comments