File tree Expand file tree Collapse file tree 4 files changed +84
-25
lines changed Expand file tree Collapse file tree 4 files changed +84
-25
lines changed Original file line number Diff line number Diff line change @@ -68,12 +68,17 @@ module.exports = function (grunt) {
68
68
'less:luma' ,
69
69
'less:backend'
70
70
] ,
71
+
71
72
/**
72
73
* Documentation
73
74
*/
74
75
documentation : [
76
+ 'replace:documentation' ,
75
77
'less:documentation' ,
76
78
'styledocco:documentation' ,
79
+ 'usebanner:documentationCss' ,
80
+ 'usebanner:documentationLess' ,
81
+ 'usebanner:documentationHtml' ,
77
82
'clean:var' ,
78
83
'clean:pub'
79
84
] ,
@@ -82,12 +87,6 @@ module.exports = function (grunt) {
82
87
'mage-minify:legacy'
83
88
] ,
84
89
85
- 'documentation-banners' : [
86
- 'usebanner:documentationCss' ,
87
- 'usebanner:documentationLess' ,
88
- 'usebanner:documentationHtml'
89
- ] ,
90
-
91
90
spec : function ( theme ) {
92
91
var runner = require ( './dev/tests/js/jasmine/spec_runner' ) ;
93
92
Original file line number Diff line number Diff line change
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
+ } ;
Original file line number Diff line number Diff line change 5
5
6
6
'use strict' ;
7
7
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 ;
22
26
}
23
- } ;
27
+ }
24
28
25
29
module . exports = {
26
30
options : {
@@ -29,31 +33,31 @@ module.exports = {
29
33
} ,
30
34
setup : {
31
35
options : {
32
- banner : banner . css ( )
36
+ banner : printCopyright ( 'css' )
33
37
} ,
34
38
files : {
35
39
src : '<%= path.css.setup %>/*.css'
36
40
}
37
41
} ,
38
42
documentationCss : {
39
43
options : {
40
- banner : banner . css ( )
44
+ banner : printCopyright ( 'css' )
41
45
} ,
42
46
files : {
43
47
src : '<%= path.doc %>/**/*.css'
44
48
}
45
49
} ,
46
50
documentationLess : {
47
51
options : {
48
- banner : banner . less ( )
52
+ banner : printCopyright ( 'less' )
49
53
} ,
50
54
files : {
51
55
src : '<%= path.doc %>/**/*.less'
52
56
}
53
57
} ,
54
58
documentationHtml : {
55
59
options : {
56
- banner : banner . html ( )
60
+ banner : printCopyright ( 'html' )
57
61
} ,
58
62
files : {
59
63
src : '<%= path.doc %>/**/*.html'
Original file line number Diff line number Diff line change 20
20
"grunt-contrib-less" : " ^0.12.0" ,
21
21
"grunt-contrib-watch" : " ^0.6.1" ,
22
22
"grunt-exec" : " ^0.4.6" ,
23
+ "grunt-replace" : " ^0.9.2" ,
23
24
"grunt-styledocco" : " ^0.1.4" ,
24
25
"grunt-template-jasmine-requirejs" : " ^0.2.3" ,
25
26
"grunt-text-replace" : " ^0.4.0" ,
You can’t perform that action at this time.
0 commit comments