Created
May 21, 2018 14:25
-
-
Save Igloczek/2eac77f0a41b1b1ada4bedba472e4596 to your computer and use it in GitHub Desktop.
Vue mixin object from component
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
const glob = require('glob') | |
const fs = require('fs') | |
glob('core/components/**/*.js', (temp, files) => { | |
files.forEach(path => { | |
// const file = require('./' + path) | |
console.log(path) | |
let file = fs.readFileSync('./' + path, 'utf8') | |
file = file.replace(/import Vue from 'vue'\n/gm, '') | |
file = file.replace(/export default Vue\.component\('.*', {/gm, 'export default {') | |
file = file.replace(/}\)\n$/g, '}\n') | |
fs.writeFileSync(path, file, 'utf8') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment