overwrite-files
v1.0.1
Published
overwrite files by your regx and callback
Downloads
7
Readme
overwrite-files
install
npm i overwrite-files
Params
Only has one param which is Object. Keys:
- src - default: null , type: string (will use path.resolve(src) in function)
- fullPath - default: null , type: string
- regx - default: null , type: Regx , required: true
- replaceCb - default: null, type: Function, required: true. (str.replace callback)
- includesFiles - default: ['*'] , type: Array
Demo
const overwriteFiles = require('./index')
const regx = /(\d+)px/
const replaceCb = word => {
let w = word.slice(0, word.length - 2)
console.log(w)
return `${w / 2}px`
}
const includesFiles = ['.vue']
overwriteFiles({ src: './src', regx, replaceCb, includesFiles })