Skip to content

Commit d67b6ea

Browse files
committed
adjust order in readme
1 parent a1a5892 commit d67b6ea

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

README.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ It allows you to write your components in this format:
3333
- [Basic Usage](#basic-usage)
3434
- [Pre-Processors](#pre-processors)
3535
- [Template Pre-Processors](#template-pre-processors)
36-
- [Scoped Styles](#scoped-styles)
37-
- [Hot Reload](#hot-reload)
3836
- [Style Imports](#style-imports)
3937
- [Asset URL Handling](#asset-url-handling)
38+
- [Scoped Styles](#scoped-styles)
39+
- [Hot Reload](#hot-reload)
4040
- [Advanced Loader Configuration](#advanced-loader-configuration)
4141
- [ES6 with Babel Example](#example-using-es6-with-babel)
4242
- [Extract CSS Example](#example-extracting-css-into-a-single-file)
@@ -92,8 +92,32 @@ You can also include Webpack loader queries in the `lang` attribute:
9292

9393
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`.
9494

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+
<style src="./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+
95117
## Scoped Styles
96118

119+
> Experimental
120+
97121
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:
98122

99123
``` html
@@ -130,6 +154,8 @@ Into the following:
130154

131155
## Hot Reload
132156

157+
> Experimental
158+
133159
When using `webpack-dev-server` in hot mode, `vue-loader` enables hot component reloading for Vue.js 1.0.0+. An example config:
134160

135161
``` js
@@ -164,28 +190,6 @@ Finally, visit `http://localhost:8080/webpack-dev-server/` to see the app with h
164190

165191
For a complete example with hot reloading in action, see [vue-hackernews](https://github.com/vuejs/vue-hackernews).
166192

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-
<style src="./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-
189193
## Advanced Loader configuration
190194

191195
By default, `vue-loader` will try to use the loader with the same name as

0 commit comments

Comments
 (0)