Skip to content

[WCM] Updating the Encore documentation + New recipe #10128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

weaverryan
Copy link
Member

See symfony/recipes#440

Basically, after a year+ of using Encore, I updated the recipe to follow best practices & clarity. This updates the docs to follow that recipe. Hopefully it makes Encore even more accessible :).

Cheers!

@weaverryan weaverryan changed the title Updating the Encore documentation + New recipe [WCM] Updating the Encore documentation + New recipe Jul 27, 2018
@weaverryan weaverryan force-pushed the webpack-encore-rewrite branch from a316586 to a2c7ad4 Compare July 27, 2018 17:36
This will match up with a recipe change.
===================

First, make sure you `install Node.js`_ and also the `Yarn package manager`_.

Then, install Encore into your project with Yarn:
Option A) If you are using Symfony Flex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do like you did with the non-flex installation page (with a tip at the top)? It's kind of ugly to have options on the "main" page about Encore installation as 99% of the time, people will have Flex.

Encore's job is simple: to read *all* of ``require`` statements and create one
final ``app.js`` (and ``app.css``) that contain *everything* your app needs. Of
course, Encore can do a lot more: minify files, pre-process Sass/LESS, support
ReactVue.js and a *lot* more.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- ReactVue.js
+ React, Vue.js

@@ -163,7 +121,7 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
// assets/js/app.js

// loads the jquery package from node_modules
const $ = require('jquery');
var $ = require('jquery');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure using var should be encouraged nowadays since it's a lot less intuitive than const/let.
Did you change it to be more consistent with the rest of the doc? Wouldn't it be better to go over the others var instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yea, I didn't want to introduce a potentially new concept here. This page now consistently uses var, but we use const in many other places in the docs. I can't think of anything better to do than what this PR does: use var in the beginning, then let const be shown in other places. Showing var everywhere isn't ideal, since it's not really used as often in practice anymore.

---------------------------
Instead of using ``require`` and ``module.exports`` like shown above, JavaScript
has an alternate syntax, which is a more accepted standard. Choose whichever you
want: they funtion identically:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- funtion
+ function

@weaverryan weaverryan closed this in bf33f2c Aug 4, 2018
@weaverryan weaverryan deleted the webpack-encore-rewrite branch August 4, 2018 01:34
@weaverryan weaverryan mentioned this pull request Aug 6, 2018
weaverryan added a commit that referenced this pull request Aug 6, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

Fixing bad syntax

Mistake from my PR #10128 :)

Commits
-------

58898b7 Fixing bad syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants