gulp-print.js 769 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const map = require("map-stream");
  4. const path = require("path");
  5. const fancyLog = require("fancy-log");
  6. const colors = require("ansi-colors");
  7. let log = fancyLog;
  8. function setLogFunction(fn) {
  9. log = fn;
  10. }
  11. exports.setLogFunction = setLogFunction;
  12. function gulpPrint(format) {
  13. if (!format) {
  14. format = (filepath) => filepath;
  15. }
  16. function mapFile(file, cb) {
  17. const filepath = colors.magenta(path.relative(process.cwd(), file.path));
  18. const formatted = format(filepath);
  19. if (formatted) {
  20. log(formatted);
  21. }
  22. cb(null, file);
  23. }
  24. return map(mapFile);
  25. }
  26. exports.default = gulpPrint;
  27. //# sourceMappingURL=gulp-print.js.map