Shazwazza / ClientDependency

DEPRECATED. A library for managing CSS & JavaScript dependencies and optimization in ASP.Net
139 stars 65 forks source link

Can ClientDependency handle source maps? #161

Closed PeteDuncanson closed 5 years ago

PeteDuncanson commented 5 years ago

I'd like to get the Umbraco back office to render out some source maps to ease debugging and development of the back office core code. I can add the source map generation into the Gulp build task for JS no problem however CD will then bundle those js files up again and I'm not sure if CD is source map aware to allow a browser to link the two together.

Any thoughts or points? Saying "no" is totally ok btw but would be nice to know.

Shazwazza commented 5 years ago

Nope. CDF's minifier is super simple, there's nothing fancy going on, it's actually very dumb... but its super fast. It doesn't build up an AST so it has no idea what code actually is.

The only thing we could try is to add functionality to CDF to tell it to not minify certain assets or bundles and just combine them. For example, if we could tell CDF, here's a bundle of core Umbraco files (which would include the JS for controllers, services, etc... ) but don't minify this bundle since the files are already done (in fact this feature is sort of requested already and we can just skip any file that is suffixed with .min.js, else this could probably also just take place within the umbraco code and cdf might not even need changing). Then you could either append your source map directly to the file, or have the file reference the external source map.

For all assets in App_Plugins, we would just minify everything like we do now.