8000 Document about alternative JS assets installation with npm packages · symfony/ux-lazy-image@7b7a9d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7b7a9d3

Browse files
committed
Document about alternative JS assets installation with npm packages
1 parent fd564ed commit 7b7a9d3

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

assets/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# @symfony/ux-lazy-image
22

3-
Lazy image loader and utilities for Symfony.
3+
JavaScript assets of the [symfony/ux-lazy-image](https://packagist.org/packages/symfony/ux-lazy-image) PHP package.
44

5-
**ℹ️ Direct installation of this package is for advanced users only.** We strongly recommend installing it through the PHP package [symfony/ux-lazy-image](https://packagist.org/packages/symfony/ux-lazy-image) in a Symfony application with Flex enabled.
5+
## Installation
66

7-
If you still want to install this package directly, **make sure its version exactly matches [symfony/ux-lazy-image](https://packagist.org/packages/symfony/ux-lazy-image) PHP package version.**
7+
This npm package is **reserved for advanced users** who want to decouple their JavaScript dependencies from their PHP dependencies (e.g., when building Docker images, running JavaScript-only pipelines, etc.).
8+
9+
We **strongly recommend not installing this package directly**, b 8000 ut instead install the PHP package [symfony/ux-lazy-image](https://packagist.org/packages/symfony/ux-lazy-image) in your Symfony application with [Flex](https://github.com/symfony/flex) enabled.
10+
11+
If you still want to install this package directly, please make sure its version exactly matches [symfony/ux-lazy-image](https://packagist.org/packages/symfony/ux-lazy-image) PHP package version:
12+
```shell
13+
composer require symfony/ux-lazy-image:2.23.0
14+
npm add @symfony/ux-lazy-image@2.23.0
15+
```
816

917
## Resources
1018

doc/index.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ needed if you're using AssetMapper):
3636
$ npm install --force
3737
$ npm run watch
3838
39+
.. note::
40+
41+
For more complex installation scenarios, you can install the JavaScript assets through the `@symfony/ux-lazy-image npm package`_
42+
3943
Usage
4044
-----
4145

@@ -216,7 +220,7 @@ on the page and should be less than 2.5 seconds. It's part of the `Core Web Vita
216220
and is used by Google to evaluate the user experience of a website, impacting
217221
the Search ranking.
218222

219-
Using the Symfony UX LazyImage for your LCP image can be a good idea at first,
223+
Using the Symfony UX LazyImage for your LCP image can be a good idea at first,
220224
but in reality, it will lower the LCP score because:
221225

222226
- `The progressive loading (through blurhash) is not taken into account in the LCP calculation`_;
@@ -239,7 +243,7 @@ A solution is to not use the Stimulus controller for the LCP image but to use
239243
width="200"
240244
height="150"
241245
/>
242-
246+
243247
This way, the browser will display the BlurHash image as soon as possible, and
244248
will load the high-definition image at the same time, without waiting for the
245249
Stimulus controller to be loaded.
@@ -262,3 +266,4 @@ https://symfony.com/doc/current/contributing/code/bc.html
262266
.. _`Core Web Vitals`: https://web.dev/vitals/
263267
.. _`The progressive loading (through blurhash) is not taken into account in the LCP calculation`: https://github.com/w3c/largest-contentful-paint/issues/71_
264268
.. _`didn't preload the image`: https://symfony.com/doc/current/web_link.html
269+
.. _`@symfony/ux-lazy-image npm package`: https://www.npmjs.com/package/@symfony/ux-lazy-image

0 commit comments

Comments
 (0)
0