Skip to content

Commit e15e034

Browse files
fix(guides) : standardize tree view on guide (#7922)
1 parent 84e95f5 commit e15e034

14 files changed

Lines changed: 268 additions & 264 deletions

src/content/guides/asset-management.mdx

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ Let's try it out by adding a new `style.css` file to our project and import it i
109109

110110
```diff
111111
webpack-demo
112-
|- package.json
113-
|- package-lock.json
114-
|- webpack.config.js
115-
|- /dist
116-
|- bundle.js
117-
|- index.html
118-
|- /src
119-
+ |- style.css
120-
|- index.js
121-
|- /node_modules
112+
├── package.json
113+
├── package-lock.json
114+
├── webpack.config.js
115+
├── /dist
116+
│ ├── bundle.js
117+
│ └── index.html
118+
├── /src
119+
+ │ ├── style.css
120+
│ └── index.js
121+
└── /node_modules
122122
```
123123

124124
**src/style.css**
@@ -215,17 +215,17 @@ Let's add an image to our project and see how this works, you can use any image
215215

216216
```diff
217217
webpack-demo
218-
|- package.json
219-
|- package-lock.json
220-
|- webpack.config.js
221-
|- /dist
222-
|- bundle.js
223-
|- index.html
224-
|- /src
225-
+ |- icon.png
226-
|- style.css
227-
|- index.js
228-
|- /node_modules
218+
├── package.json
219+
├── package-lock.json
220+
├── webpack.config.js
221+
├── /dist
222+
│ ├── bundle.js
223+
│ └── index.html
224+
├── /src
225+
+ │ ├── icon.png
226+
│ ├── style.css
227+
│ └── index.js
228+
└── /node_modules
229229
```
230230

231231
**src/index.js**
@@ -334,19 +334,19 @@ Add some font files to your project:
334334

335335
```diff
336336
webpack-demo
337-
|- package.json
338-
|- package-lock.json
339-
|- webpack.config.js
340-
|- /dist
341-
|- bundle.js
342-
|- index.html
343-
|- /src
344-
+ |- my-font.woff
345-
+ |- my-font.woff2
346-
|- icon.png
347-
|- style.css
348-
|- index.js
349-
|- /node_modules
337+
├── package.json
338+
├── package-lock.json
339+
├── webpack.config.js
340+
├── /dist
341+
│ ├── bundle.js
342+
│ └── index.html
343+
├── /src
344+
+ │ ├── my-font.woff
345+
+ │ ├── my-font.woff2
346+
│ ├── icon.png
347+
│ ├── style.css
348+
│ └── index.js
349+
└── /node_modules
350350
```
351351

352352
With the loader configured and fonts in place, you can incorporate them via an `@font-face` declaration. The local `url(...)` directive will be picked up by webpack, as it was with the image:
@@ -457,21 +457,21 @@ Add some data files to your project:
457457

458458
```diff
459459
webpack-demo
460-
|- package.json
461-
|- package-lock.json
462-
|- webpack.config.js
463-
|- /dist
464-
|- bundle.js
465-
|- index.html
466-
|- /src
467-
+ |- data.xml
468-
+ |- data.csv
469-
|- my-font.woff
470-
|- my-font.woff2
471-
|- icon.png
472-
|- style.css
473-
|- index.js
474-
|- /node_modules
460+
├── package.json
461+
├── package-lock.json
462+
├── webpack.config.js
463+
├── /dist
464+
│ ├── bundle.js
465+
│ └── index.html
466+
├── /src
467+
+ │ ├── data.xml
468+
+ │ ├── data.csv
469+
│ ├── my-font.woff
470+
│ ├── my-font.woff2
471+
│ ├── icon.png
472+
│ ├── style.css
473+
│ └── index.js
474+
└── /node_modules
475475
```
476476

477477
**src/data.xml**
@@ -715,13 +715,13 @@ Re-run the `npm run build` command and open `dist/index.html`. You should be abl
715715
The coolest part of everything mentioned above, is that loading assets this way allows you to group modules and assets in a more intuitive way. Instead of relying on a global `/assets` directory that contains everything, you can group assets with the code that uses them. For example, a structure like this can be useful:
716716

717717
```diff
718-
- |- /assets
719-
+ |– /components
720-
+ | |– /my-component
721-
+ | | |– index.jsx
722-
+ | | |– index.css
723-
+ | | |– icon.svg
724-
+ | | |– img.png
718+
- ├── /assets
719+
+ └── /components
720+
+ └── /my-component
721+
+ ├── index.jsx
722+
+ ├── index.css
723+
+ ├── icon.svg
724+
+ └── img.png
725725
```
726726

727727
This setup makes your code a lot more portable as everything that is closely coupled now lives together. Let's say you want to use `/my-component` in another project, copy or move it into the `/components` directory over there. As long as you've installed any _external dependencies_ and your _configuration has the same loaders_ defined, you should be good to go.
@@ -736,24 +736,24 @@ For the next guides we won't be using all the different assets we've used in thi
736736

737737
```diff
738738
webpack-demo
739-
|- package.json
740-
|- package-lock.json
741-
|- webpack.config.js
742-
|- /dist
743-
|- bundle.js
744-
|- index.html
745-
|- /src
746-
- |- data.csv
747-
- |- data.json5
748-
- |- data.toml
749-
- |- data.xml
750-
- |- data.yaml
751-
- |- icon.png
752-
- |- my-font.woff
753-
- |- my-font.woff2
754-
- |- style.css
755-
|- index.js
756-
|- /node_modules
739+
├── package.json
740+
├── package-lock.json
741+
├── webpack.config.js
742+
├── /dist
743+
│ ├── bundle.js
744+
│ └── index.html
745+
├── /src
746+
- │ ├── data.csv
747+
- │ ├── data.json5
748+
- │ ├── data.toml
749+
- │ ├── data.xml
750+
- │ ├── data.yaml
751+
- │ ├── icon.png
752+
- │ ├── my-font.woff
753+
- │ ├── my-font.woff2
754+
- │ ├── style.css
755+
│ └── index.js
756+
└── /node_modules
757757
```
758758

759759
**webpack.config.js**

src/content/guides/author-libraries.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ The basic project structure would look like this:
2525
**project**
2626

2727
```diff
28-
+ |- webpack.config.js
29-
+ |- package.json
30-
+ |- /src
31-
+ |- index.js
32-
+ |- ref.json
28+
+ ├── webpack.config.js
29+
+ ├── package.json
30+
+ └── /src
31+
+ ├── index.js
32+
+ └── ref.json
3333
```
3434

3535
Initialize the project with npm, then install `webpack`, `webpack-cli` and `lodash`:

src/content/guides/caching.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ Let's get our project set up using the example from [getting started](/guides/ge
3535

3636
```diff
3737
webpack-demo
38-
|- package.json
39-
|- package-lock.json
40-
|- webpack.config.js
41-
|- /dist
42-
|- /src
43-
|- index.js
44-
|- /node_modules
38+
├── package.json
39+
├── package-lock.json
40+
├── webpack.config.js
41+
├── /dist
42+
├── /src
43+
│ └── index.js
44+
└── /node_modules
4545
```
4646

4747
**webpack.config.js**
@@ -205,14 +205,14 @@ Let's add another module, `print.js`, to our project:
205205

206206
```diff
207207
webpack-demo
208-
|- package.json
209-
|- package-lock.json
210-
|- webpack.config.js
211-
|- /dist
212-
|- /src
213-
|- index.js
214-
+ |- print.js
215-
|- /node_modules
208+
├── package.json
209+
├── package-lock.json
210+
├── webpack.config.js
211+
├── /dist
212+
├── /src
213+
│ ├── index.js
214+
+│ └── print.js
215+
└── /node_modules
216216
```
217217

218218
**print.js**

src/content/guides/code-splitting.mdx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ contributors:
3636
- snitin315
3737
- artem-malko
3838
- Brennvo
39+
- ThierryRakotomanana
3940
related:
4041
- title: <link rel="prefetch/preload" /> in webpack
4142
url: https://medium.com/webpack/link-rel-prefetch-preload-in-webpack-51a52358f84c
@@ -62,15 +63,15 @@ This is by far the easiest and most intuitive way to split code. However, it is
6263
**project**
6364

6465
```diff
65-
webpack-demo
66-
|- package.json
67-
|- package-lock.json
68-
|- webpack.config.js
69-
|- /dist
70-
|- /src
71-
|- index.js
72-
+ |- another-module.js
73-
|- /node_modules
66+
webpack-demo
67+
├── package.json
68+
├── package-lock.json
69+
├── webpack.config.js
70+
├── /dist
71+
├── /src
72+
│ ├── index.js
73+
+ │ └── another-module.js
74+
└── /node_modules
7475
```
7576

7677
**another-module.js**
@@ -317,15 +318,15 @@ We'll also update our project to remove the now unused files:
317318
**project**
318319

319320
```diff
320-
webpack-demo
321-
|- package.json
322-
|- package-lock.json
323-
|- webpack.config.js
324-
|- /dist
325-
|- /src
326-
|- index.js
327-
- |- another-module.js
328-
|- /node_modules
321+
webpack-demo
322+
├── package.json
323+
├── package-lock.json
324+
├── webpack.config.js
325+
├── /dist
326+
├── /src
327+
│ ├── index.js
328+
- │ └── another-module.js
329+
└── /node_modules
329330
```
330331

331332
Now, instead of statically importing `lodash`, we'll use dynamic importing to separate a chunk:

src/content/guides/dependency-management.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ contributors:
77
- sokra
88
- byzyk
99
- AnayaDesign
10+
- ThierryRakotomanana
1011
---
1112

1213
## Dynamic expressions in import() or require()
@@ -17,13 +18,11 @@ Example, given we have the following folder structure including `.ejs` files:
1718

1819
```bash
1920
example_directory
20-
21-
└───template
22-
│ │ table.ejs
23-
│ │ table-row.ejs
24-
│ │
25-
│ └───directory
26-
│ │ another.ejs
21+
└── template/
22+
├── table.ejs
23+
├── table-row.ejs
24+
└── directory/
25+
└── another.ejs
2726
```
2827

2928
When following `import()` or `require()` call is evaluated:

src/content/guides/development.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,15 @@ The `publicPath` will be used within our server script as well in order to make
342342

343343
```diff
344344
webpack-demo
345-
|- package.json
346-
|- package-lock.json
347-
|- webpack.config.js
348-
+ |- server.js
349-
|- /dist
350-
|- /src
351-
|- index.js
352-
|- print.js
353-
|- /node_modules
345+
├── package.json
346+
├── package-lock.json
347+
├── webpack.config.js
348+
+ ├── server.js
349+
├── /dist
350+
├── /src
351+
│ ├── index.js
352+
│ └── print.js
353+
└── /node_modules
354354
```
355355

356356
**server.js**

0 commit comments

Comments
 (0)