Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update versioning without changing ClientDependency.config #175

Open
teeto opened this issue Jan 30, 2020 · 1 comment
Open

Update versioning without changing ClientDependency.config #175

teeto opened this issue Jan 30, 2020 · 1 comment

Comments

@teeto
Copy link

teeto commented Jan 30, 2020

I love ClientDependency but i hate updating the config file to change the versioning number.
I hate it because it causes an app reboot. When used on big cached websites i cant cause a reboot only for versioning. I have tried adding a ?v=1 parameter to the RequiresCss path to css but it doesnt bundle.
Is there a way i could pass a value to override de versioning of the config?
Or more simple, how could i add a parameter to the final url?

@Shazwazza
Copy link
Owner

Hi, yes this has been asked/discussed on several occasions. You cannot 'just' append an arbitrary query string to the URL, this will not solve the problem.

The CDF version is both and client side and server side cache buster.

To solve this problem a cache buster provider needs to be implemented. I was not planning on updating this project to include new features such as this since there's a predecessor to this library that I made called Smidge which has all of this functionality but it's made for .Net Core.

If you wish to contribute to this project to help create this feature than you are more than welcome to and if/when it's complete a new CDF version can be released but to do this will be tricky because we can't have any breaking changes.

Here's what would need to happen

The version in the config is an INT and this can't change since this would break the implementation here https://github.com/Shazwazza/ClientDependency/blob/master/ClientDependency.Core/Config/ClientDependencySection.cs#L19 . Instead we can add a new property called something like VersionProvider (string) which will resolve to a Type. It will be ugly, but all of CDF is based on this old provider string -> Type creation so at least it will be consistent.

We'd create an interface for IVersionProvider which would return a version string. String is far more flexible than INT, but there might be some breaking change issues with this, we won't know until it's attempted to be built in which case it might be easier to make this return an INT.

If someone specifies a type for this new config property VersionProvider then we'd try to create it and resolve it to IVersionProvider. Then throughout the codebase, wherever the original Version property was used, we'd probably replace that will a function call like GetVersion() which would either return the value from the original Version value or from the result of IVersionProvider.

Then an implementation of IVersionProvider can be created.

@Shazwazza Shazwazza changed the title Update versioning from razor without changing ClientDependency.config Update versioning without changing ClientDependency.config Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants