Skip to content

Commit 783f792

Browse files
author
Natalia Momotenko
committed
Merge remote-tracking branch 'origin/MAGETWO-38002' into PR
2 parents 897d425 + 43ce6e9 commit 783f792

File tree

4 files changed

+84
-25
lines changed

4 files changed

+84
-25
lines changed

Gruntfile.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,17 @@ module.exports = function (grunt) {
6868
'less:luma',
6969
'less:backend'
7070
],
71+
7172
/**
7273
* Documentation
7374
*/
7475
documentation: [
76+
'replace:documentation',
7577
'less:documentation',
7678
'styledocco:documentation',
79+
'usebanner:documentationCss',
80+
'usebanner:documentationLess',
81+
'usebanner:documentationHtml',
7782
'clean:var',
7883
'clean:pub'
7984
],
@@ -82,12 +87,6 @@ module.exports = function (grunt) {
8287
'mage-minify:legacy'
8388
],
8489

85-
'documentation-banners': [
86-
'usebanner:documentationCss',
87-
'usebanner:documentationLess',
88-
'usebanner:documentationHtml'
89-
],
90-
9190
spec: function (theme) {
9291
var runner = require('./dev/tests/js/jasmine/spec_runner');
9392

dev/tools/grunt/configs/replace.js

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

dev/tools/grunt/configs/usebanner.js

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

66
'use strict';
77

8-
var banner = {
9-
firstLine: 'Copyright © 2015 Magento. All rights reserved.',
10-
secondLine: 'See COPYING.txt for license details.',
11-
12-
css: function () {
13-
return '/**\n * ' + this.firstLine + '\n * ' + this.secondLine + '\n */\n';
14-
},
15-
16-
less: function () {
17-
return '// /**\n// * ' + this.firstLine + '\n// * ' + this.secondLine + '\n// */\n';
18-
},
19-
20-
html: function () {
21-
return '<!--\n/**\n * ' + this.firstLine + '\n * ' + this.secondLine + '\n */\n-->\n';
8+
function printCopyright(lang) {
9+
var copyrightText = {
10+
firstLine: 'Copyright © 2015 Magento. All rights reserved.',
11+
secondLine: 'See COPYING.txt for license details.'
12+
},
13+
nlWin = '\r\n';
14+
switch (lang) {
15+
case 'css':
16+
return '/**' + nlWin + ' * ' + copyrightText.firstLine + nlWin + ' * ' + copyrightText.secondLine + nlWin + ' */' + nlWin;
17+
break;
18+
case 'less':
19+
return '// /**' + nlWin + '// * ' + copyrightText.firstLine + nlWin + '// * ' + copyrightText.secondLine + nlWin + '// */' + nlWin;
20+
break;
21+
case 'html':
22+
return '<!--' + nlWin + '/**' + nlWin + ' * ' + copyrightText.firstLine + nlWin + ' * ' + copyrightText.secondLine + nlWin + ' */' + nlWin + '-->' + nlWin;
23+
break;
24+
default:
25+
return;
2226
}
23-
};
27+
}
2428

2529
module.exports = {
2630
options: {
@@ -29,31 +33,31 @@ module.exports = {
2933
},
3034
setup: {
3135
options: {
32-
banner: banner.css()
36+
banner: printCopyright('css')
3337
},
3438
files: {
3539
src: '<%= path.css.setup %>/*.css'
3640
}
3741
},
3842
documentationCss: {
3943
options: {
40-
banner: banner.css()
44+
banner: printCopyright('css')
4145
},
4246
files: {
4347
src: '<%= path.doc %>/**/*.css'
4448
}
4549
},
4650
documentationLess: {
4751
options: {
48-
banner: banner.less()
52+
banner: printCopyright('less')
4953
},
5054
files: {
5155
src: '<%= path.doc %>/**/*.less'
5256
}
5357
},
5458
documentationHtml: {
5559
options: {
56-
banner: banner.html()
60+
banner: printCopyright('html')
5761
},
5862
files: {
5963
src: '<%= path.doc %>/**/*.html'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"grunt-contrib-less": "^0.12.0",
2121
"grunt-contrib-watch": "^0.6.1",
2222
"grunt-exec": "^0.4.6",
23+
"grunt-replace": "^0.9.2",
2324
"grunt-styledocco": "^0.1.4",
2425
"grunt-template-jasmine-requirejs": "^0.2.3",
2526
"grunt-text-replace": "^0.4.0",

0 commit comments

Comments
 (0)