UNPKG

@matrixage/picpic

Version:

A awesome image bed by github pages and github actions.

23 lines (18 loc) 598 B
const globby = require('globby') const paths = require('../utils/paths') module.exports = async str => { const paths_source = await globby([ `${paths.getPath('../../src/components/**/*.html')}` ]) const paths_target = [] paths_source.map(item => paths_target.push(item.replace('src', '.').split('/').slice(-4).join('/')) ) const items = paths_target.map(item => '<include src="' + item + '"></include>' + '\n') return str.replace( ` <template-slot></template-slot> `, ` ${items.reduce((total, item) => (total += item), '')} ` ) }