loading external resources into the dom dynamically via data-attribute
just a simple tool to help splitting a large html document into small files and load them using html5 data-attributes
.. nothing more..nothing less
it could be useful to speed up the prototyping by making your html markup more reusabale/readable by separating each component into a separate html file.
on a live production app/website, since each separate html component will be requested by an HTTP
request..
in your html document/component, just reference the html component using data-component-url
attribute
<div data-component-url="components/header.html"></div>
<div data-component-url="components/side-bar.html"></div>
<div data-component-url="components/content.html"></div>
<div data-component-url="components/footer.html"></div>
bower install jquery.loadHtml
yeoman install jquery.loadHtml
$('body').loadHtml({
attr: 'data-component-url' // default data attribute for component url
, extension: 'html' // components file extension, if provided, no need to append it in the component-url attribute
, componentsFolder: '' // root folder where all the components can be found, if provided, no need to put prepend it in the component-url attribute
});
created by Anas Nakawa github, twitter,
special thanks for Florian Schäfer for his help.
Released under the MIT License