0.4.0 • Published 8 years ago

gulp-pattern-rename v0.4.0

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
8 years ago

gulp-pattern-rename

NPM status

Pattern based rename

Usage

This is a gulp plugin for renaming files using properties.

var patternRename = require('gulp-pattern-rename');

patternRename({
  prefix: '__',//optional
  suffix: '__',//optional
  props: {
    valueToReplace: 'newValue',
    anotherValue: 'anotherNewValue',
    package: 'one.two.three'
  }
  meta: {
    package: {
      createSubfolders: true,
      //folderSeparator is optional, use only when the separator is different from the one provided here
      //for example if you have a value like 'one/two/three' for the 'package' property, then you should use '/' for the folderSeparator
      folderSeparator: '.'
    }
  }
})

This will replace a file name in the following way:

original
__valueToReplace__SomethingElse/__package__/__valueToReplace__-__anotherValue__.js

into
newValueSomethingElse/one/two/three/newValue-anotherNewValue.js