Skip to content

Commit 34cc41f

Browse files
wouterjjderusse
andcommitted
Fix syntax of all diff code blocks
Co-authored-by: Jérémy Derussé <[email protected]>
1 parent 290ef4d commit 34cc41f

34 files changed

+334
-313
lines changed

configuration/dot-env-changes.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ changes can be made to any Symfony 3.4 or higher app:
6161
.. code-block:: diff
6262
6363
# .gitignore
64-
# ...
64+
# ...
6565
66-
###> symfony/framework-bundle ###
66+
###> symfony/framework-bundle ###
6767
- /.env
6868
+ /.env.local
6969
+ /.env.local.php
7070
+ /.env.*.local
7171
72-
# ...
72+
# ...
7373
7474
#. Rename ``.env`` to ``.env.local`` and ``.env.dist`` to ``.env``:
7575

controller.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ Add the ``use`` statement atop your controller class and then modify
9999
.. code-block:: diff
100100
101101
// src/Controller/LuckyController.php
102-
namespace App\Controller;
102+
namespace App\Controller;
103103
104104
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
105105
106106
- class LuckyController
107107
+ class LuckyController extends AbstractController
108-
{
109-
// ...
110-
}
108+
{
109+
// ...
110+
}
111111
112112
That's it! You now have access to methods like :ref:`$this->render() <controller-rendering-templates>`
113113
and many others that you'll learn about next.

doctrine.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,19 @@ methods:
281281
.. code-block:: diff
282282
283283
// src/Entity/Product.php
284-
// ...
284+
// ...
285285
286-
class Product
287-
{
288-
// ...
286+
class Product
287+
{
288+
// ...
289289
290290
+ /**
291291
+ * @ORM\Column(type="text")
292292
+ */
293293
+ private $description;
294294
295-
// getDescription() & setDescription() were also added
296-
}
295+
// getDescription() & setDescription() were also added
296+
}
297297
298298
The new property is mapped, but it doesn't exist yet in the ``product`` table. No
299299
problem! Generate a new migration:

frontend/encore/cdn.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ built files are uploaded to the CDN, configure it in Encore:
77
.. code-block:: diff
88
99
// webpack.config.js
10-
// ...
11-
12-
Encore
13-
.setOutputPath('public/build/')
14-
// in dev mode, don't use the CDN
15-
.setPublicPath('/build');
16-
// ...
17-
;
10+
// ...
11+
12+
Encore
13+
.setOutputPath('public/build/')
14+
// in dev mode, don't use the CDN
15+
.setPublicPath('/build');
16+
// ...
17+
;
1818
1919
+ if (Encore.isProduction()) {
2020
+ Encore.setPublicPath('https://my-cool-app.com.global.prod.fastly.net');

frontend/encore/copy-files.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ files into your final output directory.
3434
3535
// webpack.config.js
3636
37-
Encore
38-
// ...
39-
.setOutputPath('public/build/')
37+
Encore
38+
// ...
39+
.setOutputPath('public/build/')
4040
4141
+ .copyFiles({
4242
+ from: './assets/images',

frontend/encore/custom-loaders-plugins.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ to use the `IgnorePlugin`_ (see `moment/moment#2373`_):
5353
// webpack.config.js
5454
+ var webpack = require('webpack');
5555
56-
Encore
57-
// ...
56+
Encore
57+
// ...
5858
5959
+ .addPlugin(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
60-
;
60+
;
6161
6262
.. _`handlebars-loader`: https://github.com/pcardune/handlebars-loader
6363
.. _`plugins`: https://webpack.js.org/plugins/

frontend/encore/dev-server.rst

+14-12
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,32 @@ If you want to use SSL with self-signed certificates, add the ``--https``,
6464
the ``package.json`` file:
6565

6666
.. code-block:: diff
67+
:dedent: 0
6768
68-
{
69-
...
70-
"scripts": {
69+
{
70+
...
71+
"scripts": {
7172
- "dev-server": "encore dev-server",
7273
+ "dev-server": "encore dev-server --https --pfx=$HOME/.symfony/certs/default.p12 --allowed-hosts=mydomain.wip",
73-
...
74-
}
75-
}
74+
...
75+
}
76+
}
7677
7778
If you experience issues related to CORS (Cross Origin Resource Sharing), add
7879
the ``--disable-host-check`` and ``--port`` options to the ``dev-server``
7980
command in the ``package.json`` file:
8081

8182
.. code-block:: diff
83+
:dedent: 0
8284
83-
{
84-
...
85-
"scripts": {
85+
{
86+
...
87+
"scripts": {
8688
- "dev-server": "encore dev-server",
8789
+ "dev-server": "encore dev-server --port 8080 --disable-host-check",
88-
...
89-
}
90-
}
90+
...
91+
}
92+
}
9193
9294
.. caution::
9395

frontend/encore/faq.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ like ``/myAppSubdir``), you will need to configure that when calling ``Encore.se
6464
.. code-block:: diff
6565
6666
// webpack.config.js
67-
Encore
68-
// ...
67+
Encore
68+
// ...
6969
70-
.setOutputPath('public/build/')
70+
.setOutputPath('public/build/')
7171
7272
- .setPublicPath('/build')
7373
+ // this is your *true* public path
@@ -76,7 +76,7 @@ like ``/myAppSubdir``), you will need to configure that when calling ``Encore.se
7676
+ // this is now needed so that your manifest.json keys are still `build/foo.js`
7777
+ // (which is a file that's used by Symfony's `asset()` function)
7878
+ .setManifestKeyPrefix('build')
79-
;
79+
;
8080
8181
If you're using the ``encore_entry_script_tags()`` and ``encore_entry_link_tags()``
8282
Twig shortcuts (or are :ref:`processing your assets through entrypoints.json <load-manifest-files>`

frontend/encore/legacy-applications.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jQuery plugins often expect that jQuery is already available via the ``$`` or
3333
.. code-block:: diff
3434
3535
// webpack.config.js
36-
Encore
37-
// ...
36+
Encore
37+
// ...
3838
+ .autoProvidejQuery()
39-
;
39+
;
4040
4141
After restarting Encore, Webpack will look for all uninitialized ``$`` and ``jQuery``
4242
variables and automatically require ``jquery`` and set those variables for you.
@@ -77,8 +77,8 @@ page, add:
7777
7878
// webpack.config.js
7979
80-
// require jQuery normally
81-
const $ = require('jquery');
80+
// require jQuery normally
81+
const $ = require('jquery');
8282
8383
+ // create global $ and jQuery variables
8484
+ global.$ = global.jQuery = $;

frontend/encore/postcss.rst

+12-10
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Then, enable the loader in Encore!
3030
3131
// webpack.config.js
3232
33-
Encore
34-
// ...
33+
Encore
34+
// ...
3535
+ .enablePostCssLoader()
36-
;
36+
;
3737
3838
Because you just modified ``webpack.config.js``, stop and restart Encore.
3939

@@ -44,15 +44,15 @@ You can also pass options to the `postcss-loader`_ by passing a callback:
4444
4545
// webpack.config.js
4646
47-
Encore
48-
// ...
47+
Encore
48+
// ...
4949
+ .enablePostCssLoader((options) => {
5050
+ options.config = {
5151
+ // the directory where the postcss.config.js file is stored
5252
+ path: 'path/to/config'
5353
+ };
5454
+ })
55-
;
55+
;
5656
5757
.. _browserslist_package_config:
5858

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

6666
.. code-block:: diff
67+
:dedent: 0
6768
68-
{
69+
{
6970
+ "browserslist": [
7071
+ "defaults"
7172
+ ]
72-
}
73+
}
7374
7475
The ``defaults`` option is recommended for most users and would be equivalent
7576
to the following browserslist:
7677

7778
.. code-block:: diff
79+
:dedent: 0
7880
79-
{
81+
{
8082
+ "browserslist": [
8183
+ "> 0.5%",
8284
+ "last 2 versions",
8385
+ "Firefox ESR",
8486
+ "not dead"
8587
+ ]
86-
}
88+
}
8789
8890
See `browserslist`_ for more details on the syntax.
8991

frontend/encore/reactjs.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Enable react in your ``webpack.config.js``:
1818
.. code-block:: diff
1919
2020
// webpack.config.js
21-
// ...
21+
// ...
2222
23-
Encore
24-
// ...
23+
Encore
24+
// ...
2525
+ .enableReactPreset()
26-
;
26+
;
2727
2828
2929
Then restart Encore. When you do, it will give you a command you can run to

frontend/encore/shared-entry.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ Suppose you already have an entry called ``app`` that's included on every page.
1515
Update your code to use ``createSharedEntry()``:
1616

1717
.. code-block:: diff
18+
:dedent: 0
1819
19-
Encore
20-
// ...
20+
Encore
21+
// ...
2122
- .addEntry('app', './assets/js/app.js')
2223
+ .createSharedEntry('app', './assets/js/app.js')
23-
.addEntry('homepage', './assets/js/homepage.js')
24-
.addEntry('blog', './assets/js/blog.js')
25-
.addEntry('store', './assets/js/store.js')
24+
.addEntry('homepage', './assets/js/homepage.js')
25+
.addEntry('blog', './assets/js/blog.js')
26+
.addEntry('store', './assets/js/store.js')
2627
2728
Before making this change, if both ``app.js`` and ``store.js`` require ``jquery``,
2829
then ``jquery`` would be packaged into *both* files, which is wasteful. By making

frontend/encore/simple-example.rst

+13-12
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
168168
.. code-block:: diff
169169
170170
// assets/js/app.js
171-
// ...
171+
// ...
172172
173173
+ // loads the jquery package from node_modules
174174
+ var $ = require('jquery');
@@ -199,8 +199,8 @@ To export values using the alternate syntax, use ``export``:
199199
// assets/js/greet.js
200200
- module.exports = function(name) {
201201
+ export default function(name) {
202-
return `Yo yo ${name} - welcome to Encore!`;
203-
};
202+
return `Yo yo ${name} - welcome to Encore!`;
203+
};
204204
205205
To import values, use ``import``:
206206

@@ -241,12 +241,12 @@ Next, use ``addEntry()`` to tell Webpack to read these two new files when it bui
241241
.. code-block:: diff
242242
243243
// webpack.config.js
244-
Encore
245-
// ...
246-
.addEntry('app', './assets/js/app.js')
244+
Encore
245+
// ...
246+
.addEntry('app', './assets/js/app.js')
247247
+ .addEntry('checkout', './assets/js/checkout.js')
248248
+ .addEntry('account', './assets/js/account.js')
249-
// ...
249+
// ...
250250
251251
And because you just changed the ``webpack.config.js`` file, make sure to stop
252252
and restart Encore:
@@ -263,9 +263,10 @@ Finally, include the ``script`` and ``link`` tags on the individual pages where
263263
you need them:
264264

265265
.. code-block:: diff
266+
:dedent: 0
266267
267-
{# templates/.../checkout.html.twig #}
268-
{% extends 'base.html.twig' %}
268+
{# templates/.../checkout.html.twig #}
269+
{% extends 'base.html.twig' %}
269270
270271
+ {% block stylesheets %}
271272
+ {{ parent() }}
@@ -303,11 +304,11 @@ Then, tell Encore to enable the Sass pre-processor:
303304
.. code-block:: diff
304305
305306
// webpack.config.js
306-
Encore
307-
// ...
307+
Encore
308+
// ...
308309
309310
+ .enableSassLoader()
310-
;
311+
;
311312
312313
Because you just changed your ``webpack.config.js`` file, you'll need to restart
313314
Encore. When you do, you'll see an error!

0 commit comments

Comments
 (0)