Skip to content

Commit b941ad2

Browse files
authored
Update README.md
1 parent 0e9bcac commit b941ad2

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

template/README.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ Learn more about ES6 modules:
8787

8888
### Add a Stylesheet
8989

90-
This project setup uses [Webpack](https://webpack.github.io/) for handling all assets.
91-
Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript.
92-
93-
To express that a JavaScript file depends on a CSS file, you need to import it from the JavaScript file:
90+
This project setup uses [Webpack](https://webpack.github.io/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to import it from the JavaScript file:
9491

9592
#### `Button.css`
9693

@@ -114,16 +111,11 @@ class Button extends Component {
114111
}
115112
```
116113

117-
**This is not required for React** but many people find this feature convenient.
118-
However be aware that this makes your code less portable to other build tools and environments than Webpack.
119-
120-
In development, this allows your styles to be reloaded on the fly as you edit them.
121-
In production, all CSS files will be concatenated into a single minified `.css` file in the build output.
114+
**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.
122115

123-
You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b).
116+
In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.
124117

125-
However **you are welcome to ignore it and put all your CSS in `src/index.css` if you prefer so.**
126-
It is imported from `src/index.js`, and you can always remove that import if you migrate to a different build tool.
118+
However **you are welcome to ignore it and put all your CSS in `src/index.css` if you prefer so.** It is imported from `src/index.js`, and you can always remove that import if you migrate to a different build tool.
127119

128120
### Post-Process CSS
129121

@@ -162,8 +154,7 @@ There is currently no support for preprocessors such as Less, or for sharing var
162154

163155
With Webpack, using static assets like images and fonts works similarly to CSS.
164156

165-
You can `import` an image right in a JavaScript. This tells Webpack to include that image in the bundle.
166-
The *result* of the import is the image filename from the build output folder.
157+
You can `import` an image right in a JavaScript. This tells Webpack to include that image in the bundle. The *result* of the import is the image filename from the build output folder.
167158

168159
Here is an example:
169160

@@ -191,11 +182,11 @@ This works in CSS too:
191182

192183
Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle.
193184

194-
If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
185+
If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module.
186+
187+
The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
195188

196-
Please be advised that this is also a custom feature of Webpack.
197-
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
198-
However it may not be portable to some other environments (for example, Node.js and Browserify).
189+
Please be advised that this is also a custom feature of Webpack. **It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images). However it may not be portable to some other environments, such as Node.js and Browserify.
199190

200191
If you’d prefer to add and reference static assets in a more traditional way outside the module system, please let us know [in this issue](https://github.com/facebookincubator/create-react-app/issues/28), and we will add support for this.
201192

0 commit comments

Comments
 (0)