Skip to content

Commit 93c420e

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: incorrect session short description Use of Setters and Getters Small mistype edits Changed text how to get button label Small misspelling fixes Small typo fix Edited to show more ways, to get crawler form Adding FAQ about deploy and git Fix (sense) typo in ACL documentation [Encore] Updating for new sass options ability fixing links in table fixing bad link Adding Assetic versus Encore document
2 parents 03f46c1 + b41c973 commit 93c420e

File tree

9 files changed

+151
-11
lines changed

9 files changed

+151
-11
lines changed

components/dom_crawler.rst

+11-2
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,19 @@ given text. This method is especially useful because you can use it to return
396396
a :class:`Symfony\\Component\\DomCrawler\\Form` object that represents the
397397
form that the button lives in::
398398

399-
$form = $crawler->selectButton('validate')->form();
399+
// button example: <button id="my-super-button" type="submit">My super button</button>
400+
401+
// you can get button by its label
402+
$form = $crawler->selectButton('My super button')->form();
403+
404+
// or by button id (#my-super-button) if the button doesn't have a label
405+
$form = $crawler->selectButton('my-super-button')->form();
406+
407+
// or you can filter the whole form, for example a form has a class attribute: <form class="form-vertical" method="POST">
408+
$crawler->filter('.form-vertical')->form();
400409

401410
// or "fill" the form fields with data
402-
$form = $crawler->selectButton('validate')->form(array(
411+
$form = $crawler->selectButton('my-super-button')->form(array(
403412
'name' => 'Ryan',
404413
));
405414

controller.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ Managing the Session
453453
--------------------
454454

455455
Symfony provides a nice session object that you can use to store information
456-
about the user between requests. By default, Symfony stores the attributes in a
457-
cookie by using native PHP sessions.
456+
about the user between requests. By default, Symfony stores the token in a
457+
cookie and writes the attributes to a file by using native PHP sessions.
458458

459459
.. versionadded:: 3.3
460460
The ability to request a ``Session`` instance in controllers was introduced

controller/upload_file.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ logic to a separate service::
239239
{
240240
$fileName = md5(uniqid()).'.'.$file->guessExtension();
241241

242-
$file->move($this->targetDir, $fileName);
242+
$file->move($this->getTargetDir(), $fileName);
243243

244244
return $fileName;
245245
}

frontend.rst

+13-3
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,28 @@ Guides
6262
* :doc:`Adding custom loaders & plugins </frontend/encore/custom-loaders-plugins>`
6363
* :doc:`Advanced Webpack Configuration </frontend/encore/advanced-config>`
6464

65-
Troubleshooting
66-
...............
65+
Issues & Questions
66+
..................
6767

6868
* :doc:`FAQ & Common Issues </frontend/encore/faq>`
69+
* :doc:`/frontend/encore/versus-assetic`
6970

7071
Full API
7172
........
7273

7374
* `Full API`_: https://github.com/symfony/webpack-encore/blob/master/index.js
7475

76+
Assetic
77+
-------
78+
79+
Assetic is a pure PHP library that helps to process & optimize your assets (similar
80+
to Encore). Even though we recommend using Encore, Assetic still works great. For
81+
a comparison, see :doc:`/frontend/encore/versus-assetic`.
82+
83+
For more about Assetic, see :doc:`/assetic`.
84+
7585
Other Front-End Articles
76-
........................
86+
------------------------
7787

7888
.. toctree::
7989
:hidden:

frontend/encore/bootstrap.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ this, you can use the ``resolve_url_loader`` option:
4141
4242
// webpack.config.js
4343
Encore
44-
+ .enableSassLoader({
44+
+ .enableSassLoader(function(sassOptions) {}, {
4545
+ resolve_url_loader: false
4646
+ })
4747
;

frontend/encore/css-preprocessors.rst

+15-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@ And enable it in ``webpack.config.js``:
2222
.enableSassLoader()
2323
;
2424
25-
That's it! All files ending in ``.sass`` or ``.scss`` will be pre-processed.
25+
That's it! All files ending in ``.sass`` or ``.scss`` will be pre-processed. You
26+
can also pass options to ``sass-loader``:
27+
28+
.. code-block:: javascript
29+
30+
// webpack.config.js
31+
// ...
32+
33+
Encore
34+
// ...
35+
.enableSassLoader(function(sassOptions) {
36+
// https://github.com/sass/node-sass#options
37+
// options.includePaths = [...]
38+
});
39+
;
2640
2741
Using LESS
2842
----------

frontend/encore/faq.rst

+51
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,57 @@
11
FAQ and Common Issues
22
=====================
33

4+
How do I deploy my Encore Assets?
5+
---------------------------------
6+
7+
There are two important things to remember when deploying your assets.
8+
9+
**1) Run ``encore production``**
10+
11+
Optimize your assets for production by running:
12+
13+
.. code-block:: terminal
14+
15+
$ ./node_modules/.bin/encore production
16+
17+
That will minify your assets and make other performance optimizations. Yay!
18+
19+
But, what server should you run this command on? That depends on how you deploy.
20+
For example, you could execute this locally (or on a build server), and use rsync
21+
or something else to transfer the built files to your server. Or, you could put your
22+
files on your production server first (e.g. via a git pull) and then run this command
23+
on production (ideally, before traffic hits your code). In this case, you'll need
24+
to install Node.js on your production server.
25+
26+
**2) Only Deploy the Built Assets**
27+
28+
The *only* files that need to be deployed to your production servers are the
29+
final, built assets (e.g. the ``web/build`` directory). You do *not* need to install
30+
Node.js, deploy ``webpack.config.js``, the ``node_modules`` directory or even your source
31+
asset files, **unless** you plan on running ``encore production`` on your production
32+
machine. Once your assets are built, these are the *only* thing that need to live
33+
on the production server.
34+
35+
Do I need to Install Node.js on my Production Server?
36+
-----------------------------------------------------
37+
38+
No, unless you plan to build your production assets on your production server,
39+
which is not recommended. See `How do I deploy my Encore Assets?`_.
40+
41+
What Files Should I commit to git? And which should I Ignore?
42+
-------------------------------------------------------------
43+
44+
You should commit all of your files to git, except for the ``node_modules/`` directory
45+
and the built files. Your ``.gitignore`` file should include:
46+
47+
.. code-block:: text
48+
49+
/node_modules/
50+
# whatever path you're passing to Encore.setOutputPath()
51+
/web/build
52+
53+
You *should* commit all of your source asset files, ``package.json`` and ``yarn.lock``.
54+
455
My App Lives under a Subdirectory
556
---------------------------------
657

frontend/encore/versus-assetic.rst

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Encore Versus Assetic?
2+
======================
3+
4+
Symfony originally shipped with support for :doc:`Assetic </assetic>`: a
5+
pure PHP library capable of processing, combining and minifying CSS and JavaScript
6+
files. And while Encore is now the recommended way or processing your assets, Assetic
7+
still works well.
8+
9+
So what are the differences between Assetic and Encore?
10+
11+
+--------------------------+-------------------------------+-------------------------+
12+
| | Assetic | Encore +
13+
+--------------------------+-------------------------------+-------------------------+
14+
| Language | Pure PHP, relies on other | Node.js |
15+
| | language tools for some tasks | |
16+
+--------------------------+-------------------------------+-------------------------+
17+
| Combine assets? | Yes | Yes |
18+
+--------------------------+-------------------------------+-------------------------+
19+
| Minify assets? | Yes (when configured) | Yes (out-of-the-box) |
20+
+--------------------------+-------------------------------+-------------------------+
21+
| Process Sass/Less? | Yes | Yes |
22+
+--------------------------+-------------------------------+-------------------------+
23+
| Loads JS Modules? [1]_ | No | Yes |
24+
+--------------------------+-------------------------------+-------------------------+
25+
| Load CSS Deps in JS? [1] | No | Yes |
26+
+--------------------------+-------------------------------+-------------------------+
27+
| React, Vue.js support? | No [2]_ | Yes |
28+
+--------------------------+-------------------------------+-------------------------+
29+
| Support | Not actively maintained | Actively maintained |
30+
+--------------------------+-------------------------------+-------------------------+
31+
32+
.. [1] JavaScript modules allow you to organize your JavaScript into small files
33+
called modules and import them:
34+
35+
.. code-block:: javascript
36+
37+
// require third-party modules
38+
var $ = require('jquery');
39+
40+
// require your own CoolComponent.js modules
41+
var coolComponent = require('./components/CoolComponent');
42+
43+
Encore (via Webpack) parses these automatically and creates a JavaScript
44+
file that contains all needed dependencies. You can even require CSS or
45+
images.
46+
47+
.. [2] Assetic has outdated support for React.js only. Encore ships with modern
48+
support for React.js, Vue.js, Typescript, etc.
49+
50+
Should I Upgrade from Assetic to Encore
51+
---------------------------------------
52+
53+
If you already have Assetic working in an application, and haven't needed any of
54+
the features that Encore offers over Assetic, continuting to use Assetic is fine.
55+
If you *do* start to need more features, then you might have a business case for
56+
changing to Encore.

security/acl_advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ this request to an implementation of
190190
This allows you to replace the way access decisions are reached without actually
191191
modifying the ACL class itself.
192192

193-
The ``PermissionGrantingStrategy`` first checks all your object-scope ACEs. If none
193+
The ``PermissionGrantingStrategy`` first checks all your object-scope ACEs. If one
194194
is applicable, the class-scope ACEs will be checked. If none is applicable,
195195
then the process will be repeated with the ACEs of the parent ACL. If no
196196
parent ACL exists, an exception will be thrown.

0 commit comments

Comments
 (0)