DIY concatenated JS/CSS with central asset location
DIY concatenated JS/CSS with central asset location
I'm thinking about putting the entire DT package suite, and all its plugins, into a folder called assets
for all of my projects to reference.
How might I concat all the JS and CSS files into a single line in my index.html file?
The Download Builder does this BEAUTIFULLY, and I'm trying to think of a layman's equivalent to this.
I'm battling this idea too: Should it be centrally controlled? OR, should it be per-project? Not every project will utilize the same plugins... BUT, a concatenated/customized CSS link could reference the components each project actually needs.
Anybody ever try this?
This question has an accepted answers - jump to answer
Answers
I built something once to dynamically build the JS and CSS files. Maybe it was just me learning to code but it seemed overly complex. I even went so far as to use https://datatables.net/feeds/versions to make sure the site was running the latest versions.
The next version of that project I scrapped the above and just built concatenated files with the Download Builder and named them with the extensions included, for example:
datatables-bs-jq-sl-bu-rr.min.js
. I can use the link within the file to easily build the latest versions if needed.Not sure this answers your question but I guess the approach you take is up to your exact needs.
Kevin