Created
July 30, 2016 09:59
-
-
Save petervmeijgaard/9e7334bcfc2c2d1d342681c5c0aa9404 to your computer and use it in GitHub Desktop.
Webpack Vue File Loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
file(file, async = false) { | |
console.log(file); | |
if (async) { | |
return (resolve) => { | |
require([`${file}`], resolve); | |
}; | |
} | |
return require(`${file}`); | |
}, | |
page(main, page, async = false) { | |
const path = `./../pages/${main}/${page}/${page}.vue`; | |
return this.file(path, async); | |
}, | |
layout(layout, async = false) { | |
const path = `./../layouts/${layout}/${layout}.vue`; | |
return this.file(path, async); | |
}, | |
component(component, async = false) { | |
const path = `./../components/${component}/${component}.vue`; | |
return this.file(path, async); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment