0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-24 10:58:52 +01:00
wagtail/gulpfile.js/lib/rename-src-to-dest.js
2017-08-27 20:25:53 +02:00

20 lines
654 B
JavaScript

var rename = require('gulp-rename');
var config = require('../config');
var normalizePath = require('../lib/normalize-path');
/**
* 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 + '/' + filePath.basename + filePath.extname);
filePath.dirname = normalizePath(filePath.dirname).replace(
'/' + config.srcDir + '/',
'/' + config.destDir + '/');
if (log) console.log(filePath.dirname);
});
};
module.exports = renameSrcToDest;