refactoring

This commit is contained in:
Philipp Kühn
2020-04-18 17:08:24 +02:00
parent b6d87326ee
commit bf001d22c1

View File

@@ -49,11 +49,7 @@ export default {
content: null, content: null,
currentIndex: 0, currentIndex: 0,
syntax: { syntax: {
js: 'javascript',
jsx: 'jsx',
vue: 'markup', vue: 'markup',
css: 'css',
scss: 'scss',
}, },
} }
}, },
@@ -84,13 +80,17 @@ export default {
.keys() .keys()
.filter(path => path.startsWith(`./${this.name}`)) .filter(path => path.startsWith(`./${this.name}`))
.map(path => path.replace('./', '')) .map(path => path.replace('./', ''))
.map(path => ({ .map(path => {
path, const extension = path.split('.').pop()
name: path.replace(`${this.name}/`, ''),
content: require(`!!raw-loader!~/demos/${path}`).default, return {
extension: path.split('.').pop(), path,
highlight: this.syntax[path.split('.').pop()] || 'markup', name: path.replace(`${this.name}/`, ''),
})) content: require(`!!raw-loader!~/demos/${path}`).default,
extension,
highlight: this.syntax[extension] || extension,
}
})
} }
} }
</script> </script>