npm.io
1.6.0 • Published 4 years ago

distr

Licence
ISC
Version
1.6.0
Deps
0
Size
34 kB
Vulns
0
Weekly
0

distr

Smartly change src path to dist path, for use in small build systems.

Installation


$ npm i distr;

Configuration


  {
    source: 'src', // directory fragment to target can be RegExp: /src|source/
    destination: 'dist', // new name to use
    limit:1 // number of replacements to make
  }

Example


const distr = require('distr');

  distr('./src/www/index.html');
  //-> ./dist/www/index.html

  distr('./sources/widgets/upload-component/src/index.js', {source:/sources|src/, limit:2});
  //-> ./dist/widgets/upload-component/dist/index.js