File tree Expand file tree Collapse file tree 4 files changed +27
-24
lines changed
Filter options
Expand file tree Collapse file tree 4 files changed +27
-24
lines changed
Original file line number Diff line number Diff line change @@ -66,16 +66,18 @@ Other Front-End Articles
66
66
........................
67
67
68
68
.. toctree ::
69
- :maxdepth: 1
69
+ :hidden:
70
70
:glob:
71
71
72
- frontend/*
72
+ frontend/encore/installation
73
+ frontend/encore/simple-example
74
+ frontend/encore/*
73
75
74
76
.. toctree ::
75
- :hidden:
77
+ :maxdepth: 1
76
78
:glob:
77
79
78
- frontend/encore/ *
80
+ frontend/*
79
81
80
82
.. _`Webpack Encore` : https://www.npmjs.com/package/@symfony/webpack-encore
81
83
.. _`Webpack` : https://webpack.js.org/
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ a ``global.scss`` file, import it from there:
21
21
// assets/css/global.scss
22
22
23
23
// customize some Bootstrap variables
24
- $brand-primary : darken(#428bca , 20%);
24
+ $brand-primary : darken(#428bca , 20%);
25
25
26
26
// the ~ allows you to reference things in node_modules
27
27
@import ' ~bootstrap-sass/assets/stylesheets/bootstrap' ;
@@ -41,7 +41,7 @@ this, you can use the ``resolve_url_loader`` option:
41
41
42
42
// webpack.config.js
43
43
Encore
44
- + enableSassLoader({
44
+ + . enableSassLoader({
45
45
+ 'resolve_url_loader' => false
46
46
+ })
47
47
;
@@ -79,6 +79,7 @@ Next, make sure to call ``.autoProvidejQuery()`` in your ``webpack.config.js`` f
79
79
Encore
80
80
// ...
81
81
+ .autoProvidejQuery()
82
+ ;
82
83
83
84
This is needed because Bootstrap expects jQuery to be available as a global
84
85
variable. Now, require bootstrap from any of your JavaScript files:
Original file line number Diff line number Diff line change 1
- Installation
2
- ============
1
+ Encore Installation
2
+ ===================
3
3
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 `_.
5
5
6
- Then, install Encore into your project with yarn :
6
+ Then, install Encore into your project with Yarn :
7
7
8
8
.. code-block :: terminal
9
9
@@ -21,11 +21,11 @@ is also created/updated. When using npm 5, a ``package-lock.json`` file is creat
21
21
.. tip ::
22
22
23
23
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/ ``.
25
25
26
26
Next, create your ``webpack.config.js `` in :doc: `/frontend/encore/simple-example `!
27
27
28
28
.. _`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/
30
30
.. _`npm` : https://www.npmjs.com/
31
31
.. _`yarn` : https://yarnpkg.com/
Original file line number Diff line number Diff line change @@ -139,7 +139,16 @@ may want also to :doc:`create a shared entry </frontend/encore/shared-entry>` fo
139
139
Requiring CSS Files from JavaScript
140
140
-----------------------------------
141
141
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:
143
152
144
153
.. code-block :: javascript
145
154
@@ -149,17 +158,8 @@ You can also require CSS files from your JavaScript:
149
158
// a CSS file with the same name as the entry js will be output
150
159
require (' ../css/main.scss' );
151
160
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:
163
163
164
164
.. code-block :: diff
165
165
You can’t perform that action at this time.
0 commit comments