Skip to content

Commit 5eda32c

Browse files
committed
Tweak formatting
1 parent 8be285a commit 5eda32c

File tree

9 files changed

+94
-121
lines changed

9 files changed

+94
-121
lines changed

frontend/encore/advanced-config.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,13 @@ state of the current configuration to build a new one:
103103
When running Encore, both configurations will be built in parallel. If you
104104
prefer to build configs separately, pass the ``--config-name`` option:
105105

106-
.. configuration-block::
106+
.. code-block:: terminal
107107
108-
.. code-block:: terminal
108+
# if you use the Yarn package manager
109+
$ yarn encore dev --config-name firstConfig
109110
110-
$ yarn encore dev --config-name firstConfig
111-
112-
.. code-block:: terminal
113-
114-
$ npm run dev -- --config-name firstConfig
111+
# if you use the npm package manager
112+
$ npm run dev -- --config-name firstConfig
115113
116114
Next, define the output directories of each build:
117115

frontend/encore/bootstrap.rst

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ This article explains how to install and integrate the `Bootstrap CSS framework`
55
in your Symfony application using :doc:`Webpack Encore </frontend>`.
66
First, to be able to customize things further, we'll install ``bootstrap``:
77

8-
.. configuration-block::
8+
.. code-block:: terminal
99
10-
.. code-block:: terminal
10+
# if you use the Yarn package manager
11+
$ yarn add bootstrap --dev
1112
12-
$ yarn add bootstrap --dev
13-
14-
.. code-block:: terminal
15-
16-
$ npm install bootstrap --save-dev
13+
# if you use the npm package manager
14+
$ npm install bootstrap --save-dev
1715
1816
Importing Bootstrap Styles
1917
--------------------------
@@ -46,17 +44,15 @@ Importing Bootstrap JavaScript
4644
First, install the JavaScript dependencies required by the Bootstrap version
4745
used in your application:
4846

49-
.. configuration-block::
50-
51-
.. code-block:: terminal
52-
53-
// jQuery is only required in versions prior to Bootstrap 5
54-
$ yarn add jquery @popperjs/core --dev
47+
.. code-block:: terminal
5548
56-
.. code-block:: terminal
49+
# if you use the Yarn package manager
50+
# (jQuery is only required in versions prior to Bootstrap 5)
51+
$ yarn add jquery @popperjs/core --dev
5752
58-
// jQuery is only required in versions prior to Bootstrap 5
59-
$ npm install jquery @popperjs/core --save-dev
53+
# if you use the npm package manager
54+
# (jQuery is only required in versions prior to Bootstrap 5)
55+
$ npm install jquery @popperjs/core --save-dev
6056
6157
Now, require bootstrap from any of your JavaScript files:
6258

frontend/encore/dev-server.rst

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ Using webpack-dev-server and HMR
44
While developing, instead of using ``yarn encore dev --watch``, you can use the
55
`webpack-dev-server`_:
66

7-
.. configuration-block::
8-
9-
.. code-block:: terminal
10-
11-
$ yarn encore dev-server
7+
.. code-block:: terminal
128
13-
.. code-block:: terminal
9+
# if you use the Yarn package manager
10+
$ yarn encore dev-server
1411
15-
$ npm run dev-server
12+
# if you use the npm package manager
13+
$ npm run dev-server
1614
1715
This builds and serves the front-end assets from a new server. This server runs at
1816
``localhost:8080`` by default, meaning your build assets are available at ``localhost:8080/build``.
@@ -27,15 +25,13 @@ you're done: the paths in your templates will automatically point to the dev ser
2725
The ``dev-server`` command supports all the options defined by `webpack-dev-server`_.
2826
You can set these options via command line options:
2927

30-
.. configuration-block::
31-
32-
.. code-block:: terminal
33-
34-
$ yarn encore dev-server --https --port 9000
28+
.. code-block:: terminal
3529
36-
.. code-block:: terminal
30+
# if you use the Yarn package manager
31+
$ yarn encore dev-server --https --port 9000
3732
38-
$ npm run dev-server -- --https --port 9000
33+
# if you use the npm package manager
34+
$ npm run dev-server -- --https --port 9000
3935
4036
You can also set these options using the ``Encore.configureDevServerOptions()``
4137
method in your ``webpack.config.js`` file:

frontend/encore/installation.rst

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ Installing Encore in Symfony Applications
1111
Run these commands to install both the PHP and JavaScript dependencies in your
1212
project:
1313

14-
.. configuration-block::
14+
.. code-block:: terminal
1515
16-
.. code-block:: terminal
16+
$ composer require symfony/webpack-encore-bundle
1717
18-
$ composer require symfony/webpack-encore-bundle
19-
$ yarn install
18+
# if you use the Yarn package manager
19+
$ yarn install
2020
21-
.. code-block:: terminal
22-
23-
$ composer require symfony/webpack-encore-bundle
24-
$ npm install
21+
# if you use the npm package manager
22+
$ npm install
2523
2624
If you are using :ref:`Symfony Flex <symfony-flex>`, this will install and enable
2725
the `WebpackEncoreBundle`_, create the ``assets/`` directory, add a
@@ -37,15 +35,13 @@ Installing Encore in non Symfony Applications
3735

3836
Install Encore into your project via Yarn:
3937

40-
.. configuration-block::
41-
42-
.. code-block:: terminal
43-
44-
$ yarn add @symfony/webpack-encore --dev
38+
.. code-block:: terminal
4539
46-
.. code-block:: terminal
40+
# if you use the Yarn package manager
41+
$ yarn add @symfony/webpack-encore --dev
4742
48-
$ npm install @symfony/webpack-encore --save-dev
43+
# if you use the npm package manager
44+
$ npm install @symfony/webpack-encore --save-dev
4945
5046
This command creates (or modifies) a ``package.json`` file and downloads
5147
dependencies into a ``node_modules/`` directory. Yarn also creates/updates a

frontend/encore/postcss.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ Encore, you're done!
2121

2222
Next, download any plugins you want, like ``autoprefixer``:
2323

24-
.. configuration-block::
24+
.. code-block:: terminal
2525
26-
.. code-block:: terminal
26+
# if you use the Yarn package manager
27+
$ yarn add autoprefixer --dev
2728
28-
$ yarn add autoprefixer --dev
29-
30-
.. code-block:: terminal
31-
32-
$ npm install autoprefixer --save-dev
29+
# if you use the npm package manager
30+
$ npm install autoprefixer --save-dev
3331
3432
Next, create a ``postcss.config.js`` file at the root of your project:
3533

frontend/encore/reactjs.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ Enabling React.js
88

99
Using React? First add some dependencies with Yarn:
1010

11+
.. code-block:: terminal
1112
12-
.. configuration-block::
13+
# if you use the Yarn package manager
14+
$ yarn add react react-dom prop-types
1315
14-
.. code-block:: terminal
15-
16-
$ yarn add react react-dom prop-types
17-
18-
.. code-block:: terminal
19-
20-
$ npm install react react-dom prop-types --save
16+
# if you use the npm package manager
17+
$ npm install react react-dom prop-types --save
2118
2219
Enable react in your ``webpack.config.js``:
2320

frontend/encore/simple-example.rst

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,34 @@ together and - thanks to the first ``app`` argument - output final ``app.js`` an
5757

5858
.. _encore-build-assets:
5959

60-
To build the assets, run:
60+
To build the assets, run the following if you use the Yarn package manager:
6161

62-
.. configuration-block::
62+
.. code-block:: terminal
63+
64+
# compile assets once
65+
$ yarn encore dev
6366
64-
.. code-block:: terminal
67+
# or, recompile assets automatically when files change
68+
$ yarn encore dev --watch
6569
66-
# compile assets once
67-
$ yarn encore dev
70+
# on deploy, create a production build
71+
$ yarn encore production
6872
69-
# or, recompile assets automatically when files change
70-
$ yarn encore dev --watch
73+
# if you use the npm package manager
74+
$ npm install react react-dom prop-types --save
7175
72-
# on deploy, create a production build
73-
$ yarn encore production
76+
If you use the npm package manager, run the following commands instead:
7477

75-
.. code-block:: terminal
78+
.. code-block:: terminal
7679
77-
# compile assets once
78-
$ npm run dev
80+
# compile assets once
81+
$ npm run dev
7982
80-
# or, recompile assets automatically when files change
81-
$ npm run watch
83+
# or, recompile assets automatically when files change
84+
$ npm run watch
8285
83-
# on deploy, create a production build
84-
$ npm run build
86+
# on deploy, create a production build
87+
$ npm run build
8588
8689
.. note::
8790

@@ -166,15 +169,13 @@ files. First, create a file that exports a function:
166169
167170
We'll use jQuery to print this message on the page. Install it via:
168171

169-
.. configuration-block::
170-
171-
.. code-block:: terminal
172-
173-
$ yarn add jquery --dev
172+
.. code-block:: terminal
174173
175-
.. code-block:: terminal
174+
# if you use the Yarn package manager
175+
$ yarn add jquery --dev
176176
177-
$ npm install jquery --save-dev
177+
# if you use the npm package manager
178+
$ npm install jquery --save-dev
178179
179180
Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
180181

@@ -264,16 +265,13 @@ Next, use ``addEntry()`` to tell Webpack to read these two new files when it bui
264265
And because you just changed the ``webpack.config.js`` file, make sure to stop
265266
and restart Encore:
266267

268+
.. code-block:: terminal
267269
268-
.. configuration-block::
269-
270-
.. code-block:: terminal
271-
272-
$ yarn run encore dev --watch
273-
274-
.. code-block:: terminal
270+
# if you use the Yarn package manager
271+
$ yarn run encore dev --watch
275272
276-
$ npm run watch
273+
# if you use the npm package manager
274+
$ npm run watch
277275
278276
Webpack will now output a new ``checkout.js`` file and a new ``account.js`` file
279277
in your build directory. And, if any of those files require/import CSS, Webpack
@@ -340,17 +338,15 @@ Encore. When you do, you'll see an error!
340338
Encore supports many features. But, instead of forcing all of them on you, when
341339
you need a feature, Encore will tell you what you need to install. Run:
342340

343-
.. configuration-block::
344-
345-
.. code-block:: terminal
346-
347-
$ yarn add sass-loader@^10.0.0 sass --dev
348-
$ yarn encore dev --watch
341+
.. code-block:: terminal
349342
350-
.. code-block:: terminal
343+
# if you use the Yarn package manager
344+
$ yarn add sass-loader@^10.0.0 sass --dev
345+
$ yarn encore dev --watch
351346
352-
$ npm install sass-loader@^10.0.0 sass --save-dev
353-
$ npm run watch
347+
# if you use the npm package manager
348+
$ npm install sass-loader@^10.0.0 sass --save-dev
349+
$ npm run watch
354350
355351
Your app now supports Sass. Encore also supports LESS and Stylus. See
356352
:doc:`/frontend/encore/css-preprocessors`.

frontend/encore/url-loader.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ generated CSS files.
88
Webpack Encore provides this feature via Webpack's `URL Loader`_ plugin, but
99
it's disabled by default. First, add the URL loader to your project:
1010

11-
.. configuration-block::
11+
.. code-block:: terminal
1212
13-
.. code-block:: terminal
13+
# if you use the Yarn package manager
14+
$ yarn add url-loader --dev
1415
15-
$ yarn add url-loader --dev
16-
17-
.. code-block:: terminal
18-
19-
$ npm install url-loader --save-dev
16+
# if you use the npm package manager
17+
$ npm install url-loader --save-dev
2018
2119
Then enable it in your ``webpack.config.js``:
2220

frontend/encore/vuejs.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ The ``vue-loader`` supports hot module replacement: just update your code and wa
3535
your Vue.js app update *without* a browser refresh! To activate it, use the
3636
``dev-server`` with the ``--hot`` option:
3737

38-
.. configuration-block::
38+
.. code-block:: terminal
3939
40-
.. code-block:: terminal
40+
# if you use the Yarn package manager
41+
$ yarn encore dev-server --hot
4142
42-
$ yarn encore dev-server --hot
43-
44-
.. code-block:: terminal
45-
46-
$ npm run dev-server -- --hot
43+
# if you use the npm package manager
44+
$ npm run dev-server -- --hot
4745
4846
That's it! Change one of your ``.vue`` files and watch your browser update. But
4947
note: this does *not* currently work for *style* changes in a ``.vue`` file. Seeing

0 commit comments

Comments
 (0)