Skip to content

Commit

Permalink
Add note about cache busting for files, pipeline.AddFiles(). (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
salembream authored Feb 6, 2024
1 parent 6625c20 commit dc8f7d0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sctipt> and <link> 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
Expand Down

0 comments on commit dc8f7d0

Please sign in to comment.