| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- module.exports = function selectBlock (descriptor, loaderContext, query) {
- // template
- if (query.type === `template`) {
- loaderContext.callback(
- null,
- descriptor.template.content,
- descriptor.template.map
- )
- return
- }
- // script
- if (query.type === `script`) {
- loaderContext.callback(
- null,
- descriptor.script.content,
- descriptor.script.map
- )
- return
- }
- // styles
- if (query.type === `style` && query.index != null) {
- const style = descriptor.styles[query.index]
- loaderContext.callback(
- null,
- style.content,
- style.map
- )
- return
- }
- // custom
- if (query.type === 'custom' && query.index != null) {
- const block = descriptor.customBlocks[query.index]
- loaderContext.callback(
- null,
- block.content,
- block.map
- )
- return
- }
- }
|