Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc59d283

Browse files
committed
minor#8680 A few tiny encore tweaks (weaverryan)
This PR was squashed before being merged into the 3.3 branch (closes#8680).Discussion----------A few tiny encore tweaks... :)Commits-------48d109f A few tiny encore tweaks
2 parents433ba4f +48d109f commitc59d283

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

‎frontend.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ to solve the most common Webpack use cases.
2525
Encore is made by `Symfony`_ and works *beautifully* in Symfony applications.
2626
But it can easily be used in any application... in any language!
2727

28+
.. _encore-toc:
29+
2830
Encore Documentation
2931
--------------------
3032

‎frontend/encore/simple-example.rst‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ an ``assets/`` directory:
77
* ``assets/js/app.js``
88
* ``assets/css/app.scss``
99

10-
Let's consider that the project follows the recommended practiceofimporting
11-
theCSSfiles for their associated JavaScript files:
10+
With Encore, you should think of CSS as a *dependency*ofyour JavaScript. This means,
11+
you will *require* whateverCSSyou need from inside #"diff-885f6ae5827b90e111ec4cc3967ac27115947b60643d0cca2ebc5c83ee575fde-12-12-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">12
12

1313
..code-block::javascript
1414
@@ -38,9 +38,6 @@ Inside, use Encore to help generate your Webpack configuration.
3838
// the public path used by the web server to access the previous directory
3939
.setPublicPath('/build')
4040
41-
// empty the outputPath dir before each build
42-
.cleanupOutputBeforeBuild()
43-
4441
// will create web/build/app.js and web/build/app.css
4542
.addEntry('app','./assets/js/app.js')
4643
@@ -52,6 +49,12 @@ Inside, use Encore to help generate your Webpack configuration.
5249
5350
.enableSourceMaps(!Encore.isProduction())
5451
52+
// empty the outputPath dir before each build
53+
.cleanupOutputBeforeBuild()
54+
55+
// show OS notifications when builds finish/fail
56+
.enableBuildNotifications()
57+
5558
// create hashed filenames (e.g. app.abc123.css)
5659
// .enableVersioning()
5760
;
@@ -146,15 +149,16 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
146149
147150
That's it! When you build your assets, jQuery and ``greet.js`` will automatically
148151
be added to the output file (``app.js``). For common libraries like jQuery, you
149-
may want also to:doc:`create a shared entry</frontend/encore/shared-entry>` for better performance.
152+
may want to:doc:`create a shared entry</frontend/encore/shared-entry>` for better
153+
performance.
150154

151155
Multiple JavaScript Entries
152156
---------------------------
153157

154158
The previous example is the best way to deal with SPA (Single Page Applications)
155-
and very simple applications. However, as yourapplication grows, you'll need to
156-
define more entries with the JavaScript and CSS code of some specific sections
157-
(homepage, blog, store, etc.)
159+
and very simple applications. However, as yourapp grows, you may want to have
160+
page-specific JavaScript or CSS (e.g. homepage, blog, store, etc.). To handle this,
161+
add a new "entry" for each page that needs custom JavaScript or CSS:
158162

159163
..code-block::javascript
160164
@@ -166,5 +170,10 @@ define more entries with the JavaScript and CSS code of some specific sections
166170
;
167171
168172
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
173+
``assets/css/homepage.scss``), two files will be generated for each:
170174
(e.g. ``build/homepage.js`` and ``build/homepage.css``).
175+
176+
Keep Going!
177+
-----------
178+
179+
Go back to the:ref:`Encore Top List<encore-toc>` to learn more and add new features.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp