element-plus/build/gulp-rewriter.ts

17 lines
359 B
TypeScript
Raw Normal View History

import through2 from 'through2'
const rewriter = (rewriteTo = '../..') => {
return through2.obj(function(file, _, cb) {
2021-08-24 16:52:44 +08:00
const compIdentifier = new RegExp('@element-plus', 'g')
file.contents = Buffer.from(
file.contents
.toString()
2021-08-24 16:52:44 +08:00
.replace(compIdentifier, rewriteTo),
)
cb(null, file)
})
}
export default rewriter