Nanobots Protecting Microbots
Join us to discuss the challenges, solutions and best practices for in-house JavaScript code sharing. Tuesday, 12/17 at 10am PT/1pm ET.Sign up here »

overwrite-files

1.0.1 • Public • Published

overwrite-files

install

npm i overwrite-files

Params

Only has one param which is Object. Keys:

  1. src - default: null , type: string (will use path.resolve(src) in function)
  2. fullPath - default: null , type: string
  3. regx - default: null , type: Regx , required: true
  4. replaceCb - default: null, type: Function, required: true. (str.replace callback)
  5. 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 `${/ 2}px`
}
 
const includesFiles = ['.vue']
 
overwriteFiles({ src: './src', regx, replaceCb, includesFiles })

Install

npm i overwrite-files

DownloadsWeekly Downloads

3

Version

1.0.1

License

ISC

Unpacked Size

3.91 kB

Total Files

7

Last publish

Collaborators

  • avatar