Can we realize dynamically loading, of js, css and other files, process?
By getting all needed info (what we must to load) from html tags data attributes?
For example:
<html>
<head>
<title>Our app</title>
</head>
<body data-load-css="style">
<div class="all" data-load-js="jquery|jqueryui" data-load-js-type="async">
<div class="header" data-load-js="main">
Header
</div>
<div class="body" data-load-js="body">
Body
<div class="some-tipsy" data-load-css="tipsy"></div>
</div>
<div class="footer" data-load-js="other">
Footer
<div class="some-other" data-load-css="other"></div>
</div>
</div>
<script>
// our js app to load dynamically js, css
</script>
</body>
</html>
So, maybe you have some ideas how do it in best way? With the best performance and flexibility.
Or I just need to use require js, and don't worry about some "new things"? If just require js, then how do it best with this js plugin? To load all stuff most dynamically?
And how solve problem with js async, defer loding? Where some scripts must be loaded in specific order.
Here is my continued version 2 of current question: https://stackoverflow.com/questions/34413940/dynamically-load-js-files-by-html-data-attr-dependencies