From dc8f7d0d29f593db500c241a8c4a80ac6de3531d Mon Sep 17 00:00:00 2001 From: Salem AlBream Date: Tue, 6 Feb 2024 20:26:29 +0300 Subject: [PATCH] Add note about cache busting for files, `pipeline.AddFiles()`. (#235) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 84cc606..9b48e97 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,16 @@ They will get a version string added as a URL parameter: This version string changes every time one or more of the source files are modified. +**NOTE:** TagHelpers will only work on files registered as assets on the pipeline (will not work for all files in your and tags out of the blue). make sure to add all required files as assets (glob is supported to add wildcard paths). + +```csharp +services.AddWebOptimizer(pipeline => +{ + pipeline.AddFiles("text/javascript", "/dist/*"); + pipeline.AddFiles("text/css", "/css/*"); +}); +``` + This technique is called *cache busting* and is a critical component to achieving high performance, since we cannot utilize browser caching of the CSS and JavaScript files without it. That is also why it can not be disabled when using WebOptimizer. #### HTTPS Compression Considerations