Skip to content

Commit 4b9ccdd

Browse files
committed
Fix code-diff
1 parent 1839389 commit 4b9ccdd

33 files changed

+393
-338
lines changed

configuration/dot-env-changes.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,18 @@ changes can be made to any Symfony 3.4 or higher app:
5555
#. Update ``.gitignore``:
5656

5757
.. code-block:: diff
58+
:dedent: 0
5859
59-
# .gitignore
60-
# ...
60+
# .gitignore
61+
# ...
6162
62-
###> symfony/framework-bundle ###
63+
###> symfony/framework-bundle ###
6364
- /.env
6465
+ /.env.local
6566
+ /.env.local.php
6667
+ /.env.*.local
6768
68-
# ...
69+
# ...
6970
7071
#. Rename ``.env`` to ``.env.local`` and ``.env.dist`` to ``.env``:
7172

controller.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,18 @@ Add the ``use`` statement atop your controller class and then modify
9797
``LuckyController`` to extend it:
9898

9999
.. code-block:: diff
100+
:dedent: 0
100101
101-
// src/Controller/LuckyController.php
102-
namespace App\Controller;
102+
// src/Controller/LuckyController.php
103+
namespace App\Controller;
103104
104105
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
105106
106107
- class LuckyController
107108
+ class LuckyController extends AbstractController
108-
{
109-
// ...
110-
}
109+
{
110+
// ...
111+
}
111112
112113
That's it! You now have access to methods like :ref:`$this->render() <controller-rendering-templates>`
113114
and many others that you'll learn about next.

doctrine.rst

+8-7
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,22 @@ This adds the new ``description`` property and ``getDescription()`` and ``setDes
279279
methods:
280280

281281
.. code-block:: diff
282+
:dedent: 0
282283
283-
// src/Entity/Product.php
284-
// ...
284+
// src/Entity/Product.php
285+
// ...
285286
286-
class Product
287-
{
288-
// ...
287+
class Product
288+
{
289+
// ...
289290
290291
+ /**
291292
+ * @ORM\Column(type="text")
292293
+ */
293294
+ private $description;
294295
295-
// getDescription() & setDescription() were also added
296-
}
296+
// getDescription() & setDescription() were also added
297+
}
297298
298299
The new property is mapped, but it doesn't exist yet in the ``product`` table. No
299300
problem! Generate a new migration:

frontend/encore/cdn.rst

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ Are you deploying to a CDN? That's awesome :) Once you've made sure that your
55
built files are uploaded to the CDN, configure it in Encore:
66

77
.. code-block:: diff
8+
:dedent: 0
89
9-
// webpack.config.js
10-
// ...
10+
// webpack.config.js
11+
// ...
1112
12-
Encore
13-
.setOutputPath('public/build/')
14-
// in dev mode, don't use the CDN
15-
.setPublicPath('/build');
16-
// ...
17-
;
13+
Encore
14+
.setOutputPath('public/build/')
15+
// in dev mode, don't use the CDN
16+
.setPublicPath('/build');
17+
// ...
18+
;
1819
1920
+ if (Encore.isProduction()) {
2021
+ Encore.setPublicPath('https://my-cool-app.com.global.prod.fastly.net');

frontend/encore/copy-files.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ Webpack - like a template - you can use the ``copyFiles()`` method to copy those
3131
files into your final output directory.
3232

3333
.. code-block:: diff
34+
:dedent: 0
3435
35-
// webpack.config.js
36+
// webpack.config.js
3637
37-
Encore
38-
// ...
39-
.setOutputPath('public/build/')
38+
Encore
39+
// ...
40+
.setOutputPath('public/build/')
4041
4142
+ .copyFiles({
4243
+ from: './assets/images',

frontend/encore/custom-loaders-plugins.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,16 @@ via the ``addPlugin()`` method. For example, if you use `Moment.js`_, you might
4949
to use the `IgnorePlugin`_ (see `moment/moment#2373`_):
5050

5151
.. code-block:: diff
52+
:dedent: 0
5253
53-
// webpack.config.js
54+
// webpack.config.js
5455
+ var webpack = require('webpack');
5556
56-
Encore
57-
// ...
57+
Encore
58+
// ...
5859
5960
+ .addPlugin(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
60-
;
61+
;
6162
6263
.. _`handlebars-loader`: https://github.com/pcardune/handlebars-loader
6364
.. _`plugins`: https://webpack.js.org/plugins/

frontend/encore/dev-server.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ you'll need to also tell the dev-server to use HTTPS. To do this, you can reuse
6565
server SSL certificate:
6666

6767
.. code-block:: diff
68+
:dedent: 0
6869
69-
// webpack.config.js
70-
// ...
70+
// webpack.config.js
71+
// ...
7172
+ const path = require('path');
7273
73-
Encore
74-
// ...
74+
Encore
75+
// ...
7576
7677
+ .configureDevServerOptions(options => {
7778
+ options.https = {

frontend/encore/faq.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ If your app does not live at the root of your web server (i.e. it lives under a
6262
like ``/myAppSubdir``), you will need to configure that when calling ``Encore.setPublicPath()``:
6363

6464
.. code-block:: diff
65+
:dedent: 0
6566
66-
// webpack.config.js
67-
Encore
68-
// ...
67+
// webpack.config.js
68+
Encore
69+
// ...
6970
70-
.setOutputPath('public/build/')
71+
.setOutputPath('public/build/')
7172
7273
- .setPublicPath('/build')
7374
+ // this is your *true* public path
@@ -76,7 +77,7 @@ like ``/myAppSubdir``), you will need to configure that when calling ``Encore.se
7677
+ // this is now needed so that your manifest.json keys are still `build/foo.js`
7778
+ // (which is a file that's used by Symfony's `asset()` function)
7879
+ .setManifestKeyPrefix('build')
79-
;
80+
;
8081
8182
If you're using the ``encore_entry_script_tags()`` and ``encore_entry_link_tags()``
8283
Twig shortcuts (or are :ref:`processing your assets through entrypoints.json <load-manifest-files>`

frontend/encore/legacy-applications.rst

+7-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ jQuery plugins often expect that jQuery is already available via the ``$`` or
3131
``webpack.config.js`` file:
3232

3333
.. code-block:: diff
34+
:dedent: 0
3435
35-
Encore
36-
// ...
36+
Encore
37+
// ...
3738
+ .autoProvidejQuery()
38-
;
39+
;
3940
4041
After restarting Encore, Webpack will look for all uninitialized ``$`` and ``jQuery``
4142
variables and automatically require ``jquery`` and set those variables for you.
@@ -73,9 +74,10 @@ For example, in your ``app.js`` file that's processed by Webpack and loaded on e
7374
page, add:
7475

7576
.. code-block:: diff
77+
:dedent: 0
7678
77-
// require jQuery normally
78-
const $ = require('jquery');
79+
// require jQuery normally
80+
const $ = require('jquery');
7981
8082
+ // create global $ and jQuery variables
8183
+ global.$ = global.jQuery = $;

frontend/encore/postcss.rst

+16-12
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,35 @@ Next, create a ``postcss.config.js`` file at the root of your project:
2727
Then, enable the loader in Encore!
2828

2929
.. code-block:: diff
30+
:dedent: 0
3031
31-
// webpack.config.js
32+
// webpack.config.js
3233
33-
Encore
34-
// ...
34+
Encore
35+
// ...
3536
+ .enablePostCssLoader()
36-
;
37+
;
3738
3839
Because you just modified ``webpack.config.js``, stop and restart Encore.
3940

4041
That's it! The ``postcss-loader`` will now be used for all CSS, Sass, etc files.
4142
You can also pass options to the `postcss-loader`_ by passing a callback:
4243

4344
.. code-block:: diff
45+
:dedent: 0
4446
45-
// webpack.config.js
47+
// webpack.config.js
4648
+ const path = require('path');
4749
48-
Encore
49-
// ...
50+
Encore
51+
// ...
5052
+ .enablePostCssLoader((options) => {
5153
+ options.postcssOptions = {
5254
+ // the directory where the postcss.config.js file is stored
5355
+ config: path.resolve(__dirname, 'sub-dir', 'custom.config.js'),
5456
+ };
5557
+ })
56-
;
58+
;
5759
5860
.. _browserslist_package_config:
5961

@@ -65,26 +67,28 @@ support. The best-practice is to configure this directly in your ``package.json`
6567
(so that all the tools can read this):
6668

6769
.. code-block:: diff
70+
:dedent: 0
6871
69-
{
72+
{
7073
+ "browserslist": [
7174
+ "defaults"
7275
+ ]
73-
}
76+
}
7477
7578
The ``defaults`` option is recommended for most users and would be equivalent
7679
to the following browserslist:
7780

7881
.. code-block:: diff
82+
:dedent: 0
7983
80-
{
84+
{
8185
+ "browserslist": [
8286
+ "> 0.5%",
8387
+ "last 2 versions",
8488
+ "Firefox ESR",
8589
+ "not dead"
8690
+ ]
87-
}
91+
}
8892
8993
See `browserslist`_ for more details on the syntax.
9094

frontend/encore/reactjs.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ Using React? First add some dependencies with Yarn:
1616
Enable react in your ``webpack.config.js``:
1717

1818
.. code-block:: diff
19+
:dedent: 0
1920
20-
// webpack.config.js
21-
// ...
21+
// webpack.config.js
22+
// ...
2223
23-
Encore
24-
// ...
24+
Encore
25+
// ...
2526
+ .enableReactPreset()
26-
;
27+
;
2728
2829
2930
Then restart Encore. When you do, it will give you a command you can run to

frontend/encore/simple-example.rst

+19-14
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ We'll use jQuery to print this message on the page. Install it via:
166166
Great! Use ``import`` to import ``jquery`` and ``greet.js``:
167167

168168
.. code-block:: diff
169+
:dedent: 0
169170
170-
// assets/app.js
171-
// ...
171+
// assets/app.js
172+
// ...
172173
173174
+ // loads the jquery package from node_modules
174175
+ import jquery from 'jquery';
@@ -208,14 +209,15 @@ etc.). To handle this, create a new "entry" JavaScript file for each page:
208209
Next, use ``addEntry()`` to tell Webpack to read these two new files when it builds:
209210

210211
.. code-block:: diff
212+
:dedent: 0
211213
212-
// webpack.config.js
213-
Encore
214-
// ...
215-
.addEntry('app', './assets/app.js')
214+
// webpack.config.js
215+
Encore
216+
// ...
217+
.addEntry('app', './assets/app.js')
216218
+ .addEntry('checkout', './assets/checkout.js')
217219
+ .addEntry('account', './assets/account.js')
218-
// ...
220+
// ...
219221
220222
And because you just changed the ``webpack.config.js`` file, make sure to stop
221223
and restart Encore:
@@ -232,9 +234,10 @@ Finally, include the ``script`` and ``link`` tags on the individual pages where
232234
you need them:
233235

234236
.. code-block:: diff
237+
:dedent: 0
235238
236-
{# templates/.../checkout.html.twig #}
237-
{% extends 'base.html.twig' %}
239+
{# templates/.../checkout.html.twig #}
240+
{% extends 'base.html.twig' %}
238241
239242
+ {% block stylesheets %}
240243
+ {{ parent() }}
@@ -262,21 +265,23 @@ CSS you can also use Sass, LESS or Stylus. To use Sass, rename the ``app.css``
262265
file to ``app.scss`` and update the ``import`` statement:
263266

264267
.. code-block:: diff
268+
:dedent: 0
265269
266-
// assets/app.js
270+
// assets/app.js
267271
- import './styles/app.css';
268272
+ import './styles/app.scss';
269273
270274
Then, tell Encore to enable the Sass pre-processor:
271275

272276
.. code-block:: diff
277+
:dedent: 0
273278
274-
// webpack.config.js
275-
Encore
276-
// ...
279+
// webpack.config.js
280+
Encore
281+
// ...
277282
278283
+ .enableSassLoader()
279-
;
284+
;
280285
281286
Because you just changed your ``webpack.config.js`` file, you'll need to restart
282287
Encore. When you do, you'll see an error!

0 commit comments

Comments
 (0)