Skip to content

Commit efe6427

Browse files
author
Bogdan Plieshka
committed
MAGETWO-38002: Automate UI Documentation build process with Grunt.js
- Changed banners place and replace to unisystem solution
1 parent 007a11c commit efe6427

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

dev/tools/grunt/configs/replace.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55

66
'use strict';
77

8-
function findCopyright(lang) {
8+
var nlWin = '\r\n',
9+
nlMac = '\n';
10+
11+
function findCopyright(lang, newLineSystem) {
912
var copyrightText = {
1013
firstLine: 'Copyright © 2015 Magento. All rights reserved.',
1114
secondLine: 'See COPYING.txt for license details.'
1215
};
1316
switch (lang) {
1417
case 'less':
1518
return new RegExp(
16-
'// /\\*\\*\r\n// \\* ' +
19+
'// /\\*\\*' + newLineSystem + '// \\* ' +
1720
copyrightText.firstLine +
18-
'\r\n// \\* ' +
21+
'' + newLineSystem + '// \\* ' +
1922
copyrightText.secondLine +
20-
'\r\n// \\*/\r\n\r\n'
23+
'' + newLineSystem + '// \\*/' + newLineSystem + newLineSystem
2124
);
2225
break;
2326
default:
@@ -28,10 +31,16 @@ function findCopyright(lang) {
2831
module.exports = {
2932
documentation: {
3033
options: {
31-
patterns: [{
32-
match: findCopyright('less'),
33-
replacement: ''
34-
}]
34+
patterns: [
35+
{
36+
match: findCopyright('less', nlMac),
37+
replacement: ''
38+
},
39+
{
40+
match: findCopyright('less', nlWin),
41+
replacement: ''
42+
}
43+
]
3544
},
3645
files: [{
3746
expand: true,

dev/tools/grunt/configs/usebanner.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77

88
function printCopyright(lang) {
99
var copyrightText = {
10-
firstLine: 'Copyright © 2015 Magento. All rights reserved.',
11-
secondLine: 'See COPYING.txt for license details.'
12-
};
10+
firstLine: 'Copyright © 2015 Magento. All rights reserved.',
11+
secondLine: 'See COPYING.txt for license details.'
12+
},
13+
nlWin = '\r\n';
1314
switch (lang) {
1415
case 'css':
15-
return '/**\n * ' + copyrightText.firstLine + '\n * ' + copyrightText.secondLine + '\n */\n';
16+
return '/**' + nlWin + ' * ' + copyrightText.firstLine + nlWin + ' * ' + copyrightText.secondLine + nlWin + ' */' + nlWin;
1617
break;
1718
case 'less':
18-
return '// /**\n// * ' + copyrightText.firstLine + '\n// * ' + copyrightText.secondLine + '\n// */\n';
19+
return '// /**' + nlWin + '// * ' + copyrightText.firstLine + nlWin + '// * ' + copyrightText.secondLine + nlWin + '// */' + nlWin;
1920
break;
2021
case 'html':
21-
return '<!--\n/**\n * ' + copyrightText.firstLine + '\n * ' + copyrightText.secondLine + '\n */\n-->\n';
22+
return '<!--' + nlWin + '/**' + nlWin + ' * ' + copyrightText.firstLine + nlWin + ' * ' + copyrightText.secondLine + nlWin + ' */' + nlWin + '-->' + nlWin;
2223
break;
2324
default:
2425
return;

0 commit comments

Comments
 (0)