It would be nice to be able manage Javascript and CSS files within store templates. I know this can be done today using URI management, but that would sacrifice features like consolidation and minification. Plus, there would be a performance penalty to running all of those requests through Merchant instead of serving static files.
My theory is that Merchant could allow editing the JS and CSS in templates just like other pages, but on update, write a new minified, consolidated file to the server. On update, pages with JS or CSS content could also run syntax validation (usually done during minification anyways). If there's an error, it won't save. It should also track a version number that is available as a variable to other templates for appending to the script or css URL to facilitate correct browser caching.
This would offer the convenience and power of template-based code management while retaining the performance benefits of traditional workflows. I'd love to hear feedback from others on this idea.
My theory is that Merchant could allow editing the JS and CSS in templates just like other pages, but on update, write a new minified, consolidated file to the server. On update, pages with JS or CSS content could also run syntax validation (usually done during minification anyways). If there's an error, it won't save. It should also track a version number that is available as a variable to other templates for appending to the script or css URL to facilitate correct browser caching.
This would offer the convenience and power of template-based code management while retaining the performance benefits of traditional workflows. I'd love to hear feedback from others on this idea.
Comment