Skip to content

Commit b339149

Browse files
brieucthomasweaverryan
authored andcommitted
[Encore] Fix invalid javascript code
1 parent d3aeca9 commit b339149

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

frontend.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,18 @@ Other Front-End Articles
6666
........................
6767

6868
.. toctree::
69-
:maxdepth: 1
69+
:hidden:
7070
:glob:
7171

72-
frontend/*
72+
frontend/encore/installation
73+
frontend/encore/simple-example
74+
frontend/encore/*
7375

7476
.. toctree::
75-
:hidden:
77+
:maxdepth: 1
7678
:glob:
7779

78-
frontend/encore/*
80+
frontend/*
7981

8082
.. _`Webpack Encore`: https://www.npmjs.com/package/@symfony/webpack-encore
8183
.. _`Webpack`: https://webpack.js.org/

frontend/encore/bootstrap.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ a ``global.scss`` file, import it from there:
2121
// assets/css/global.scss
2222
2323
// customize some Bootstrap variables
24-
$brand-primary: darken(#428bca, 20%);
24+
$brand-primary: darken(#428bca, 20%);
2525
2626
// the ~ allows you to reference things in node_modules
2727
@import '~bootstrap-sass/assets/stylesheets/bootstrap';
@@ -41,8 +41,8 @@ this, you can use the ``resolve_url_loader`` option:
4141
4242
// webpack.config.js
4343
Encore
44-
+ enableSassLoader({
45-
+ 'resolve_url_loader' => false
44+
+ .enableSassLoader({
45+
+ resolve_url_loader: false
4646
+ })
4747
;
4848
@@ -79,6 +79,7 @@ Next, make sure to call ``.autoProvidejQuery()`` in your ``webpack.config.js`` f
7979
Encore
8080
// ...
8181
+ .autoProvidejQuery()
82+
;
8283
8384
This is needed because Bootstrap expects jQuery to be available as a global
8485
variable. Now, require bootstrap from any of your JavaScript files:

frontend/encore/installation.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Installation
2-
============
1+
Encore Installation
2+
===================
33

4-
First, make sure you `install Node.js`_ and also the `yarn package manager`_.
4+
First, make sure you `install Node.js`_ and also the `Yarn package manager`_.
55

6-
Then, install Encore into your project with yarn:
6+
Then, install Encore into your project with Yarn:
77

88
.. code-block:: terminal
99
@@ -21,11 +21,11 @@ is also created/updated. When using npm 5, a ``package-lock.json`` file is creat
2121
.. tip::
2222

2323
You should commit ``package.json`` and ``yarn.lock`` (or ``package-lock.json``
24-
if using npm) to version control, but ignore ``node_modules/``.
24+
if using npm 5) to version control, but ignore ``node_modules/``.
2525

2626
Next, create your ``webpack.config.js`` in :doc:`/frontend/encore/simple-example`!
2727

2828
.. _`install Node.js`: https://nodejs.org/en/download/
29-
.. _`yarn package manager`: https://yarnpkg.com/lang/en/docs/install/
29+
.. _`Yarn package manager`: https://yarnpkg.com/lang/en/docs/install/
3030
.. _`npm`: https://www.npmjs.com/
3131
.. _`yarn`: https://yarnpkg.com/

frontend/encore/simple-example.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,16 @@ may want also to :doc:`create a shared entry </frontend/encore/shared-entry>` fo
139139
Requiring CSS Files from JavaScript
140140
-----------------------------------
141141

142-
You can also require CSS files from your JavaScript:
142+
Above, you created an entry called ``app`` that pointed to ``main.js``:
143+
144+
.. code-block:: javascript
145+
146+
Encore
147+
// ...
148+
.addEntry('app', './assets/js/main.js')
149+
;
150+
151+
Once inside ``main.js``, you can even require CSS files:
143152

144153
.. code-block:: javascript
145154
@@ -149,17 +158,8 @@ You can also require CSS files from your JavaScript:
149158
// a CSS file with the same name as the entry js will be output
150159
require('../css/main.scss');
151160
152-
In this case, ``main.js`` is being added to an entry called ``app`` in ``webpack.config.js``:
153-
154-
.. code-block:: javascript
155-
156-
Encore
157-
// ...
158-
.addEntry('app', './assets/js/main.js')
159-
160-
As soon as you require a CSS file, both an ``app.js`` **and** an ``app.css`` file
161-
will be created. You'll need to add a link tag to the ``app.css`` file in your
162-
templates:
161+
Now, both an ``app.js`` **and** an ``app.css`` file will be created. You'll need
162+
to add a link tag to the ``app.css`` file in your templates:
163163

164164
.. code-block:: diff
165165

0 commit comments

Comments
 (0)