diff --git a/README.md b/README.md index 587b0d5..9cef294 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # http-vue-loader Load .vue files directly from your html/js. No node.js environment, no build step. +Supports loading SFC files via XMLHttpRequest (http or data scheme) and text via text scheme or inline script elements. + ## examples `my-component.vue` @@ -66,6 +68,60 @@ using `httpVueLoader()` ... ``` +or, using `httpVueLoader()` with data url + +```html +... + +').trim() + }; + } + else { + var comp = url.match(/(.*?)([^/]+?)\/?(\.vue)?(\?.*|#.*|$)/); + return { + name: comp[2], + url: comp[1] + comp[2] + (comp[3] === undefined ? (comp[1].substr(0, 5) !== 'data:' ? '/index.vue' : '') : comp[3]) + comp[4] + }; + } } function resolveURL(baseURL, url) { @@ -460,6 +481,13 @@ }); }; + httpVueLoader.textPromise = function(url) { + + return new Promise(function(resolve, reject) { + resolve(url.substr(5)); + }); + }; + httpVueLoader.langProcessor = { html: identity, js: identity,