You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #45845 [TwigBundle] Pre-compile only *.twig files in cache warmup (GromNaN)
This PR was merged into the 6.1 branch.
Discussion
----------
[TwigBundle] Pre-compile only *.twig files in cache warmup
| Q | A
| ------------- | ---
| Branch? | 6.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
In my project, the template directory contains all the frontend assets (CSS, JS and images), this is a choice to locate all component files in the same directories. But the asset files are compiled as if they were twig template, which is a waste of time and storage.
```
front/
├─ components/
│ ├─ video/
│ │ ├─ templates/
│ │ │ ├─ video.html.twig
│ │ ├─ styles/
│ │ │ ├─ video.css
│ │ ├─ scripts/
│ │ │ ├─ video.js
```
~This patch limit warmup to `*.twig` files.~
This PR adds an option to restrict file pattern, for cache warmup and lint.
```yaml
twig:
file_name_pattern: "*.twig"
```
| | Before | After |
|------------------|--------|-------|
| Time to generate | 25s | 9s |
| Storage | 80MB | 26MB |
| Number of files | 4800 | 1500 |
The filter on `*.twig` files is already in the `lint:twig` command.
Note: If a non-twig template is included in a template (ex: to inline CSS), the `source()` function must be used ; the cache is not used in this case.
Commits
-------
4de7a0227b Use an option for twig file names in cache warmer and linter
0 commit comments