@@ -57,31 +57,34 @@ together and - thanks to the first ``app`` argument - output final ``app.js`` an
5757
5858.. _encore-build-assets :
5959
60- To build the assets, run:
60+ To build the assets, run the following if you use the Yarn package manager :
6161
62- .. configuration-block ::
62+ .. code-block :: terminal
63+
64+ # compile assets once
65+ $ yarn encore dev
6366
64- .. code-block :: terminal
67+ # or, recompile assets automatically when files change
68+ $ yarn encore dev --watch
6569
66- # compile assets once
67- $ yarn encore dev
70+ # on deploy, create a production build
71+ $ yarn encore production
6872
69- # or, recompile assets automatically when files change
70- $ yarn encore dev --watch
73+ # if you use the npm package manager
74+ $ npm install react react-dom prop-types --save
7175
72- # on deploy, create a production build
73- $ yarn encore production
76+ If you use the npm package manager, run the following commands instead:
7477
75- .. code-block :: terminal
78+ .. code-block :: terminal
7679
77- # compile assets once
78- $ npm run dev
80+ # compile assets once
81+ $ npm run dev
7982
80- # or, recompile assets automatically when files change
81- $ npm run watch
83+ # or, recompile assets automatically when files change
84+ $ npm run watch
8285
83- # on deploy, create a production build
84- $ npm run build
86+ # on deploy, create a production build
87+ $ npm run build
8588
8689 .. note ::
8790
@@ -166,15 +169,13 @@ files. First, create a file that exports a function:
166169
167170 We'll use jQuery to print this message on the page. Install it via:
168171
169- .. configuration-block ::
170-
171- .. code-block :: terminal
172-
173- $ yarn add jquery --dev
172+ .. code-block :: terminal
174173
175- .. code-block :: terminal
174+ # if you use the Yarn package manager
175+ $ yarn add jquery --dev
176176
177- $ npm install jquery --save-dev
177+ # if you use the npm package manager
178+ $ npm install jquery --save-dev
178179
179180 Great! Use ``require() `` to import ``jquery `` and ``greet.js ``:
180181
@@ -264,16 +265,13 @@ Next, use ``addEntry()`` to tell Webpack to read these two new files when it bui
264265 And because you just changed the ``webpack.config.js `` file, make sure to stop
265266and restart Encore:
266267
268+ .. code-block :: terminal
267269
268- .. configuration-block ::
269-
270- .. code-block :: terminal
271-
272- $ yarn run encore dev --watch
273-
274- .. code-block :: terminal
270+ # if you use the Yarn package manager
271+ $ yarn run encore dev --watch
275272
276- $ npm run watch
273+ # if you use the npm package manager
274+ $ npm run watch
277275
278276 Webpack will now output a new ``checkout.js `` file and a new ``account.js `` file
279277in your build directory. And, if any of those files require/import CSS, Webpack
@@ -340,17 +338,15 @@ Encore. When you do, you'll see an error!
340338 Encore supports many features. But, instead of forcing all of them on you, when
341339you need a feature, Encore will tell you what you need to install. Run:
342340
343- .. configuration-block ::
344-
345- .. code-block :: terminal
346-
347- $ yarn add sass-loader@^10.0.0 sass --dev
348- $ yarn encore dev --watch
341+ .. code-block :: terminal
349342
350- .. code-block :: terminal
343+ # if you use the Yarn package manager
344+ $ yarn add sass-loader@^10.0.0 sass --dev
345+ $ yarn encore dev --watch
351346
352- $ npm install sass-loader@^10.0.0 sass --save-dev
353- $ npm run watch
347+ # if you use the npm package manager
348+ $ npm install sass-loader@^10.0.0 sass --save-dev
349+ $ npm run watch
354350
355351 Your app now supports Sass. Encore also supports LESS and Stylus. See
356352:doc: `/frontend/encore/css-preprocessors `.
0 commit comments