Open KingScooty opened 12 years ago
I'm pretty sure this can be done without the surrounding html comments. On each script replacement, a basic check can be done to see if it's hosted on a cdn (i'm also thinking of cdnjs here) and if it's jquery or a fallback replacement.
This surely slightly increase the complexity of the usemin task, but if the value added is worth it..
Relatedly, I'm wondering if we should provide an option to simply remove cdn + fallback script in favor of one single <script defer src="bundle.js"></script>
with all libraries and application code. Ideally, the bundle.js would be specific for each file depending on what script imports they use in template files (either it is .html
or other extensions).
I originally thought that you were talking about the other way around, eg. switching from minified to non minified version of jQuery. The original h5bp repo do use minified version so we should keep it that way. However in development, I often use non minified version of third-party libs as it can come handy to inspect the source. It might be good to have a special task to switch between minified version to non-minified version and vice versa, but that should be kept outside of the usemin task I guess.
These are my thoughts :)
Yeah, in development/staging i try to use non-minified versions of all scripts for easier debugging etc. So it would be quite nice to be able to switch between jQueries too.
I only mentioned comments as i like to heavily document all my code, so i guess we can always strip out comments separately.
Relatedly, I'm wondering if we should provide an option to simply remove cdn + fallback script in favor of one single with all libraries and application code. Ideally, the bundle.js would be specific for each file depending on what script imports they use in template files (either it is .html or other extensions).
This could be a nice optional feature. I'm not too sure how to go about it though.
So i've started to look into this issue. The most straight forward answer is to switch between non-minified and minified versions of the Google CDN hosted file, while falling back to the permanently minified locally hosted one:
Index.html:
usemin.js:
But this is far from ideal.
*.html /footer.php
.