1

I have my CSS and JS in my layout page.

I need to add a param string to the CSS and JS when I do changes and I upload them with these changes.

For example:

<environment names="Production">
    <link href="~/dist/mycss.bundle.css" rel="stylesheet"/>
</environment>

To:

<environment names="Production">
    <link href="~/dist/mycss.bundle.css?param=withchanges" rel="stylesheet"/>
</environment>

What is the best way to do that? Has new ASP.NET 5 a way to do that?

1 Answer 1

7

there is a built in taghelper that is just for this purpose

<link href="~/dist/mycss.bundle.css" rel="stylesheet" asp-append-version="true"/>

by adding the asp-append-version=true, a hash of the file contents will be automatically appended to the url so it will change if the file contents change.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.