-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Document about alternative JS assets installation with npm packages #2617
base: 2.x
Are you sure you want to change the base?
Conversation
If you're using WebpackEncore, install your assets and restart Encore (not | ||
needed if you're using AssetMapper): | ||
|
||
.. code-block:: terminal | ||
|
||
$ npm install --force | ||
$ npm run watch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no assets for symfony/ux-map
, so let's remove this confusing part.
9e2ee48
to
a767b6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Teh way I see this is that we now have 3 different ways of installing this:
(1) PHP-based and uses AssetMapper
.. code-block:: terminal
$ composer require symfony/ux-cropperjs
(2) PHP-based and uses WebpackEncore
.. code-block:: terminal
$ composer require symfony/ux-cropperjs
$ npm install --force
$ npm run watch
(3) JavaScript-based
.. code-block:: terminal
$ npm add @symfony/ux-cropperjs package
My questions:
- Is (3) totally equivalent to (1) and (2)
- If not, in which scenarios would someone use (3) vs (1) or (2)?
Based on the answers to these questions, let's think about the best possible way of showing this information. Thanks.
(3) alone is not possible, each UX packages on npm (e.g.: https://www.npmjs.com/package/@symfony/ux-chartjs, https://www.npmjs.com/package/@symfony/ux-translator, ...) mention that the npm package must also install the php package. See #2575 an #691 for more information, but to resume, having standalone JavaScript packages would allow users to install their JavaScript dependencies without needing PHP/Composer, which can be pretty useful in a CI (building Docker images, deploying an app, running JS tests, ...). I would adapt your examples like this: (1) PHP-based and uses AssetMapper $ composer require symfony/ux-cropperjs (2) PHP-based and uses WebpackEncore $ composer require symfony/ux-cropperjs
$ # if user prefers to keep things separated: npm add -D @symfony/ux-cropperjs
$ npm install --force
$ npm run watch What do you think about that?
This is exactly why I added you as a reviewer 🤗 |
Thanks for the insights. I would expand each installation section as follows: Installation
------------
.. caution::
Before you start, make sure you have `StimulusBundle configured in your app`_.
Run the following command to install this package:
.. code-block:: terminal
$ composer require symfony/ux-cropperjs
If your Symfony application uses `AssetMapper`_, you don't have to do anything else
and can move on to the next section.
If your Symfony application uses `Webpack Encore`_, run the following commands
to install the assets and restart Encore:
.. code-block:: terminal
$ npm install --force
$ npm run watch
.. tip::
The assets of this package are also provided as the standalone `@symfony/ux-cropperjs`_
JavaScript package. This is useful, for example, on continuous integration servers
to build Docker images, run JavaScript tests, etc. without using PHP/Composer.
Usage
-----
[...]
.. _`AssetMapper`: https://symfony.com/doc/current/frontend/asset_mapper.html
.. _`Webpack Encore`: https://symfony.com/doc/current/frontend/encore/index.html Although docs should be concise, I think it's fine to be a bit verbose/detailed in the I'd mention the scenarios where the JS package is useful. Experts won't need it, but the rest of folks would need this to decide if this is something for them or not. I have a pending question. In the original text, we say things like:
What happens if the reader doesn't have Flex installed? Which steps should be done manually? Thanks |
I really like your suggestion, thanks Javier!
If Flex is not installed, then the reader must do (unknown) operations manually:
Which is far from being ideal. |
Follow #2616