0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-22 11:07:57 +01:00
wagtail/gulpfile.js/lib/rename-src-to-dest.js
2021-10-01 16:25:29 +01:00

20 lines
638 B
JavaScript

var path = require('path');
var rename = require('gulp-rename');
var config = require('../config');
/**
* Returns a configured gulp-rename to pipe from asset sources to dest.
* Usage: .pipe(renameSrcToDest())
*/
var renameSrcToDest = function(log) {
return rename(function(filePath) {
if (log) console.log(filePath.dirname + path.sep + filePath.basename + filePath.extname);
filePath.dirname = filePath.dirname.replace(
path.sep + config.srcDir + path.sep,
path.sep + config.destDir + path.sep);
if (log) console.log(filePath.dirname);
});
};
module.exports = renameSrcToDest;