2
0

rename-src-to-dest.js 638 B

12345678910111213141516171819
  1. var path = require('path');
  2. var rename = require('gulp-rename');
  3. var config = require('../config');
  4. /**
  5. * Returns a configured gulp-rename to pipe from asset sources to dest.
  6. * Usage: .pipe(renameSrcToDest())
  7. */
  8. var renameSrcToDest = function(log) {
  9. return rename(function(filePath) {
  10. if (log) console.log(filePath.dirname + path.sep + filePath.basename + filePath.extname);
  11. filePath.dirname = filePath.dirname.replace(
  12. path.sep + config.srcDir + path.sep,
  13. path.sep + config.destDir + path.sep);
  14. if (log) console.log(filePath.dirname);
  15. });
  16. };
  17. module.exports = renameSrcToDest;