jetheredge / SquishIt

Lets you *easily* bundle some css and javascript! Check out the Google group if you have questions!
http://groups.google.com/group/squishit
MIT License
459 stars 119 forks source link

V1 release notes #344

Open jpmnteiro opened 6 years ago

jpmnteiro commented 6 years ago

Hi,

Just noticed that v1 was released on nuget (yay for the project). Are there any release notes for this version and/or any migration path for folks who are upgrading from v0.9.9 (e.g, how can one change the default PathTranslator? what about the cache invalidation strategy?) you can point me to?

AlexCuse commented 6 years ago

All that I have written so far is in the release notes at https://www.nuget.org/packages/SquishIt (which becomes a legacy package containing only references with this release - in the future installing SquishIt.AspNet will be preferred).

From those release notes:

In SquishIt 1.0 this will become a legacy package. The library has been split into two - one containing the processing logic and the other containing ASP.net specific implementation. This will eliminate dependency on System.Web for users on Nancy and other platforms. In version 1.1 this package will be deprecated. For the ASP.net functionality that SquishIt traditionally provided the package SquishIt.AspNet can be installed - it will bring the framework with it.

There is also a new configuration API coming with the package split. Behavior modification and preprocessor registration can be achieved by calling SquishIt.Framework.Configuration.Apply with an Action that modifies the global configuration. The SquishIt.AspNet library will automatically register itself via PreApplicationStart method, as will all the preprocessors maintained as part of the SquishIt codebase.

I was planning to write something up in the next couple weeks as time allows but maybe we can work it out in this issue. I think the changes are pretty straightforward. That Apply method referenced takes an Action that allows you to override the default configuration at all the points that existed previously. Path translator and cache invalidation strategy can be manipulated in there for sure. See this file from the .AspNet package, which is wired up to execute automatically using WebActivator

https://github.com/jetheredge/SquishIt/blob/master/SquishIt.AspNet/ConfigurationLoader.cs

Hopefully the self registration will make things easier.

You may also want to look at the configuration itself https://github.com/jetheredge/SquishIt/blob/master/SquishIt.Framework/Configuration.cs

Typically stuff in the platform configuration would be changed by packages like SquishIt.AspNet but I can think of reasons you would want to implement your own path translator to deal with virtual directories or similar. If you need to override something like that, my advice is to call that Configuration.Apply method on Application_Start (or in Startup for an OWIN app) to ensure that it is executed AFTER all the referenced assemblies register themselves rather than on loading the assembly.

Thanks and let me know any issues you run into, it will help make whatever "upgrade guide" I put together more useful.

jpmnteiro commented 6 years ago

Hey @AlexCuse, thanks for the write up, good to know the path the project is taking (and to reiterate, thank you for this, it's been massively helpful).

I'll try to update to v1 (again) soon and I'll let you know which parts of the upgrade cause me trouble so you can add them to the "guide" if they make sense.

AlexCuse commented 6 years ago

Great let me know how you get on.

Curious why you need to override the path translator - are you using Nancy, or do you have an odd virtual directory setup?

jpmnteiro commented 6 years ago

@AlexCuse using Nancy on a website that can be hosted on IIS or self hosted (using OWIN/Katana). Due to the way the self host is written, the paths need to be translated to work correctly.

AlexCuse commented 6 years ago

You might be the perfect person to be guinea pigging this stuff - the main reason for the package split was to dump the System.Web baggage from the main library and make it easier for people using Nancy and similar. I hope to publish a SquishIt.Nancy package eventually but don't really know it well enough at this point (have only used nancy for stuff marginally more complex than hello world).

jpmnteiro commented 6 years ago

Happy to help, just let me know what you need.

Getting rid of System.Web is a great direction IMHO. It certainly caters to people using Nancy and/or Suave.