Skip to content

Instantly share code, notes, and snippets.

@Igloczek
Created May 21, 2018 14:25
Show Gist options
  • Save Igloczek/2eac77f0a41b1b1ada4bedba472e4596 to your computer and use it in GitHub Desktop.
Save Igloczek/2eac77f0a41b1b1ada4bedba472e4596 to your computer and use it in GitHub Desktop.
Vue mixin object from component
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