Giter Club home page Giter Club logo

Comments (3)

ericraider33 avatar ericraider33 commented on July 23, 2024 1

Excellent reply. Thanks for the help...

from bundling.

ericraider33 avatar ericraider33 commented on July 23, 2024

As a footnote, when I changed from run-time bundling to design-time bundling, everything works fine. So for now, I'll just roll with the design-time stuff.

from bundling.

adams85 avatar adams85 commented on July 23, 2024

However, when I use with a bundled script, nothing is added to the URL. See content below.

asp-append-version is a base ASP.NET Core tag helper attribute, it won't work with bundles produced by this library.

Is there a work around or something built into the bundler for append a version? I want to make sure that users' browsers don't use cached bundles when a new, updated version is available.

Bundle versioning and cache busting is built into the library and supported out of the box. As a matter of fact, cache busting is automatically enabled in Production environments by default. You can however override this behavior using the EnableCacheBusting method. E.g. if you want to enable it regardless of the runtime environment, just make an EnableCacheBusting(true) call on the builder returned by AddBundling.

It's also worth mentioning that you can also control

  • whether hash-based (UseHashVersioning) or timestamp-based (UseTimestampVersioning) versioning is to be used and
  • whether to append the version to the path (UseFileNameVersioning) or query string (UseQueryStringVersioning) part of the URL.

By default hash-based versions are used and appended to the path part.

One more thing to note: instead of asp-append-version you can use the bundling-add-version attribute to override the global versioning settings for individual bundles.

As a footnote, when I changed from run-time bundling to design-time bundling, everything works fine. So for now, I'll just roll with the design-time stuff.

All the above also goes for design-time bundling (in case you configure the bundle services properly and call the InitializeBundling method as shown in the quick start template project).

In the case of design-time bundling asp-append-version accidentally works, however I recommend choosing the library's "idiomatic" way of versioning because that provides more control and lets you switch between design-time and run-time bundling easily.

from bundling.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.