Skip to content

Commit e71d137

Browse files
committed
Fix code-diff
1 parent 9b334b0 commit e71d137

34 files changed

+414
-355
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

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

8484
.. code-block:: diff
85+
:dedent: 0
8586
86-
{
87-
...
88-
"scripts": {
87+
{
88+
...
89+
"scripts": {
8990
- "dev-server": "encore dev-server",
9091
+ "dev-server": "encore dev-server --https --pfx=$HOME/.symfony/certs/default.p12 --allowed-hosts=mydomain.wip",
91-
...
92-
}
93-
}
92+
...
93+
}
94+
}
9495
9596
If you experience issues related to CORS (Cross Origin Resource Sharing), add
9697
the ``--disable-host-check`` and ``--port`` options to the ``dev-server``
9798
command in the ``package.json`` file:
9899

99100
.. code-block:: diff
101+
:dedent: 0
100102
101-
{
102-
...
103-
"scripts": {
103+
{
104+
...
105+
"scripts": {
104106
- "dev-server": "encore dev-server",
105107
+ "dev-server": "encore dev-server --port 8080 --disable-host-check",
106-
...
107-
}
108-
}
108+
...
109+
}
110+
}
109111
110112
.. caution::
111113

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,32 +27,34 @@ 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
47-
Encore
48-
// ...
49+
Encore
50+
// ...
4951
+ .enablePostCssLoader((options) => {
5052
+ options.config = {
5153
+ // the directory where the postcss.config.js file is stored
5254
+ path: 'path/to/config'
5355
+ };
5456
+ })
55-
;
57+
;
5658
5759
.. _browserslist_package_config:
5860

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

6668
.. code-block:: diff
69+
:dedent: 0
6770
68-
{
71+
{
6972
+ "browserslist": [
7073
+ "defaults"
7174
+ ]
72-
}
75+
}
7376
7477
The ``defaults`` option is recommended for most users and would be equivalent
7578
to the following browserslist:
7679

7780
.. code-block:: diff
81+
:dedent: 0
7882
79-
{
83+
{
8084
+ "browserslist": [
8185
+ "> 0.5%",
8286
+ "last 2 versions",
8387
+ "Firefox ESR",
8488
+ "not dead"
8589
+ ]
86-
}
90+
}
8791
8892
See `browserslist`_ for more details on the syntax.
8993

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/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/app.js')
2223
+ .createSharedEntry('app', './assets/app.js')
23-
.addEntry('homepage', './assets/homepage.js')
24-
.addEntry('blog', './assets/blog.js')
25-
.addEntry('store', './assets/store.js')
24+
.addEntry('homepage', './assets/homepage.js')
25+
.addEntry('blog', './assets/blog.js')
26+
.addEntry('store', './assets/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

0 commit comments

Comments
 (0)