replace.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. 'use strict';
  6. var nlWin = '\r\n',
  7. nlUnix = '\n';
  8. function findCopyright(lang, nlSys) {
  9. var copyrightText = {
  10. firstLine: 'Copyright © Magento, Inc. All rights reserved.',
  11. secondLine: 'See COPYING.txt for license details.'
  12. };
  13. switch (lang) {
  14. case 'less':
  15. return new RegExp(
  16. '// /\\*\\*' + nlSys + '// \\* ' +
  17. copyrightText.firstLine +
  18. '' + nlSys + '// \\* ' +
  19. copyrightText.secondLine +
  20. '' + nlSys + '// \\*/' + nlSys + nlSys
  21. );
  22. break;
  23. default:
  24. return;
  25. }
  26. }
  27. module.exports = {
  28. documentation: {
  29. options: {
  30. patterns: [
  31. {
  32. match: findCopyright('less', nlWin),
  33. replacement: ''
  34. },
  35. {
  36. match: findCopyright('less', nlUnix),
  37. replacement: ''
  38. }
  39. ]
  40. },
  41. files: [{
  42. expand: true,
  43. flatten: true,
  44. src: [
  45. '<%= path.doc %>/source/**/*.less'
  46. ],
  47. dest: '<%= path.doc %>/source/'
  48. }]
  49. }
  50. };