Skip to content

Commit bd360d5

Browse files
committed
Merge remote-tracking branch 'upstream/3.3' into 3.3
2 parents abf57cf + d464e84 commit bd360d5

File tree

4 files changed

+57
-37
lines changed

4 files changed

+57
-37
lines changed

configuration/micro_kernel_trait.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ that define your bundles, your services and your routes:
9494
This is the same ``registerBundles()`` that you see in a normal kernel.
9595

9696
**configureContainer(ContainerBuilder $c, LoaderInterface $loader)**
97-
This methods builds and configures the container. In practice, you will use
97+
This method builds and configures the container. In practice, you will use
9898
``loadFromExtension`` to configure different bundles (this is the equivalent
9999
of what you see in a normal ``config.yml`` file). You can also register services
100100
directly in PHP or load external configuration files (shown below).

contributing/code/standards.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ Service Naming Conventions
222222
* Use lowercase letters for service and parameter names (except when referring
223223
to environment variables with the ``%env(VARIABLE_NAME)%`` syntax);
224224

225-
* A group name uses the underscore notation.
225+
* A group name uses the underscore notation;
226+
227+
* Add class aliases for public services (e.g. alias ``Symfony\Component\Something\ClassName``
228+
to ``something.service_name``).
226229

227230
Documentation
228231
-------------

frontend/encore/simple-example.rst

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@ First Example
44
Imagine you have a simple project with one CSS and one JS file, organized into
55
an ``assets/`` directory:
66

7-
* ``assets/js/main.js``
8-
* ``assets/css/global.scss``
7+
* ``assets/js/app.js``
8+
* ``assets/css/app.scss``
99

10-
With Encore, we can easily minify these files, pre-process ``global.scss``
10+
Let's consider that the project follows the recommended practice of importing
11+
the CSS files for their associated JavaScript files:
12+
13+
.. code-block:: javascript
14+
15+
// assets/js/app.js
16+
require('../css/app.scss');
17+
18+
// ...rest of JavaScript code here
19+
20+
With Encore, we can easily minify these files, pre-process ``app.scss``
1121
through Sass and a *lot* more.
1222

1323
Configuring Encore/Webpack
@@ -22,20 +32,17 @@ Inside, use Encore to help generate your Webpack configuration.
2232
var Encore = require('@symfony/webpack-encore');
2333
2434
Encore
25-
// directory where all compiled assets will be stored
35+
// the project directory where all compiled assets will be stored
2636
.setOutputPath('web/build/')
2737
28-
// what's the public path to this directory (relative to your project's document root dir)
38+
// the public path used by the web server to access the previous directory
2939
.setPublicPath('/build')
3040
3141
// empty the outputPath dir before each build
3242
.cleanupOutputBeforeBuild()
3343
34-
// will output as web/build/app.js
35-
.addEntry('app', './assets/js/main.js')
36-
37-
// will output as web/build/global.css
38-
.addStyleEntry('global', './assets/css/global.scss')
44+
// will create web/build/app.js and web/build/app.css
45+
.addEntry('app', './assets/js/app.js')
3946
4047
// allow sass/scss files to be processed
4148
.enableSassLoader()
@@ -83,7 +90,7 @@ Actually, to use ``enableSassLoader()``, you'll need to install a few
8390
more packages. But Encore will tell you *exactly* what you need.
8491

8592
After running one of these commands, you can now add ``script`` and ``link`` tags
86-
to the new, compiled assets (e.g. ``/build/global.css`` and ``/build/app.js``).
93+
to the new, compiled assets (e.g. ``/build/app.css`` and ``/build/app.js``).
8794
In Symfony, use the ``asset()`` helper:
8895

8996
.. code-block:: twig
@@ -93,7 +100,7 @@ In Symfony, use the ``asset()`` helper:
93100
<html>
94101
<head>
95102
<!-- ... -->
96-
<link rel="stylesheet" href="{{ asset('build/global.css') }}">
103+
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
97104
</head>
98105
<body>
99106
<!-- ... -->
@@ -124,7 +131,7 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
124131

125132
.. code-block:: javascript
126133
127-
// assets/js/main.js
134+
// assets/js/app.js
128135
129136
// loads the jquery package from node_modules
130137
var $ = require('jquery');
@@ -141,32 +148,23 @@ That's it! When you build your assets, jQuery and ``greet.js`` will automaticall
141148
be added to the output file (``app.js``). For common libraries like jQuery, you
142149
may want also to :doc:`create a shared entry </frontend/encore/shared-entry>` for better performance.
143150

144-
Requiring CSS Files from JavaScript
145-
-----------------------------------
151+
Multiple JavaScript Entries
152+
---------------------------
146153

147-
Above, you created an entry called ``app`` that pointed to ``main.js``:
154+
The previous example is the best way to deal with SPA (Single Page Applications)
155+
and very simple applications. However, as your application grows, you'll need to
156+
define more entries with the JavaScript and CSS code of some specific sections
157+
(homepage, blog, store, etc.)
148158

149159
.. code-block:: javascript
150160
151161
Encore
152162
// ...
153-
.addEntry('app', './assets/js/main.js')
163+
.addEntry('homepage', './assets/js/homepage.js')
164+
.addEntry('blog', './assets/js/blog.js')
165+
.addEntry('store', './assets/js/store.js')
154166
;
155167
156-
Once inside ``main.js``, you can even require CSS files:
157-
158-
.. code-block:: javascript
159-
160-
// assets/js/main.js
161-
// ...
162-
163-
// a CSS file with the same name as the entry js will be output
164-
require('../css/main.scss');
165-
166-
Now, both an ``app.js`` **and** an ``app.css`` file will be created. You'll need
167-
to add a link tag to the ``app.css`` file in your templates:
168-
169-
.. code-block:: diff
170-
171-
<link rel="stylesheet" href="{{ asset('build/global.css') }}">
172-
+ <link rel="stylesheet" href="{{ asset('build/app.css') }}">
168+
If those entries include CSS/Sass files (e.g. ``homepage.js`` requires
169+
``assets/css/homepage.scss``), two files will be generated for each of them
170+
(e.g. ``build/homepage.js`` and ``build/homepage.css``).

reference/configuration/framework.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Configuration
102102
* :ref:`enable_annotations <reference-validation-enable_annotations>`
103103
* `translation_domain`_
104104
* `strict_email`_
105-
* `mapping`_
105+
* :ref:`mapping <reference-validation-mapping>`
106106
* :ref:`paths <reference-validation-mapping-paths>`
107107
* `annotations`_
108108
* :ref:`cache <reference-annotations-cache>`
@@ -114,6 +114,8 @@ Configuration
114114
* :ref:`enable_annotations <reference-serializer-enable_annotations>`
115115
* :ref:`name_converter <reference-serializer-name_converter>`
116116
* :ref:`circular_reference_handler <reference-serializer-circular_reference_handler>`
117+
* :ref:`mapping <reference-serializer-mapping>`
118+
* :ref:`paths <reference-serializer-mapping-paths>`
117119
* `php_errors`_
118120
* `log`_
119121
* `throw`_
@@ -1637,6 +1639,8 @@ If this option is enabled, the `egulias/email-validator`_ library will be
16371639
used by the :doc:`/reference/constraints/Email` constraint validator. Otherwise,
16381640
the validator uses a simple regular expression to validate email addresses.
16391641

1642+
.. _reference-validation-mapping:
1643+
16401644
mapping
16411645
.......
16421646

@@ -1762,6 +1766,21 @@ method.
17621766
For more information, see
17631767
:ref:`component-serializer-handling-circular-references`.
17641768

1769+
.. _reference-serializer-mapping:
1770+
1771+
mapping
1772+
.......
1773+
1774+
.. _reference-serializer-mapping-paths:
1775+
1776+
paths
1777+
"""""
1778+
1779+
**type**: ``array`` **default**: ``[]``
1780+
1781+
This option allows to define an array of paths with files or directories where
1782+
the component will look for additional serialization files.
1783+
17651784
php_errors
17661785
~~~~~~~~~~
17671786

0 commit comments

Comments
 (0)