Skip to content

Commit 8ed380e

Browse files
author
Bogdan Plieshka
committed
MAGETWO-34156: [UI] refactor variables names according to our code standards
- Refactored theme.less files to handle new theme creation with nesting (moved local theme variables to variables files) - Less files renaming, separation to compiled and imports - Separated and renamed global lib variables according to less style guide - Added banners addition task for Grunt
1 parent d8f1163 commit 8ed380e

File tree

241 files changed

+11509
-10897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+11509
-10897
lines changed

Gruntfile.js

+59-8
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,23 @@ module.exports = function (grunt) {
126126
}
127127
};
128128

129+
// Banners
130+
// ---------------------------------------------
131+
132+
var banner = {
133+
firstLine: 'Copyright © <%= grunt.template.today("yyyy") %> Magento. All rights reserved.',
134+
secondLine: 'See COPYING.txt for license details.',
135+
css: function(){
136+
return '/**\n * ' + this.firstLine + '\n * ' + this.secondLine + '\n */\n';
137+
},
138+
less: function(){
139+
return '// /**\n// * ' + this.firstLine + '\n// * ' + this.secondLine + '\n// */\n';
140+
},
141+
html: function(){
142+
return '<!--\n/**\n * ' + this.firstLine + '\n * ' + this.secondLine + '\n */\n-->\n';
143+
}
144+
};
145+
129146
// Tasks
130147
// _____________________________________________
131148

@@ -135,6 +152,7 @@ module.exports = function (grunt) {
135152
path: path,
136153
theme: theme,
137154
combo: combo,
155+
banner: banner,
138156

139157
// Execution into cmd
140158
// ---------------------------------------------
@@ -343,21 +361,48 @@ module.exports = function (grunt) {
343361
}
344362
},
345363

346-
// Concatenation
364+
// Banners
347365
// ---------------------------------------------
348366

349-
concat: {
367+
usebanner: {
350368
options: {
351-
stripBanners: true,
352-
banner: '/**\n * Copyright © <%= grunt.template.today("yyyy") %> Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n'
369+
position: 'top',
370+
linebreak: true
353371
},
354372
setup: {
355-
src: '<%= path.css.setup %>/setup.css',
356-
dest: '<%= path.css.setup %>/setup.css'
373+
options: {
374+
banner: banner.css()
375+
},
376+
files: {
377+
src: '<%= path.css.setup %>/*.css'
378+
}
379+
},
380+
documentationCss: {
381+
options: {
382+
banner: banner.css()
383+
},
384+
files: {
385+
src: '<%= path.doc %>/**/*.css'
386+
}
387+
},
388+
documentationLess: {
389+
options: {
390+
banner: banner.less()
391+
},
392+
files: {
393+
src: '<%= path.doc %>/**/*.less'
394+
}
395+
},
396+
documentationHtml: {
397+
options: {
398+
banner: banner.html()
399+
},
400+
files: {
401+
src: '<%= path.doc %>/**/*.html'
402+
}
357403
}
358404
},
359405

360-
361406
// Watches files for changes and runs tasks based on the changed files
362407
// ---------------------------------------------
363408

@@ -552,6 +597,12 @@ module.exports = function (grunt) {
552597
'clean:pub'
553598
]);
554599

600+
grunt.registerTask('documentation-banners', [
601+
'usebanner:documentationCss',
602+
'usebanner:documentationLess',
603+
'usebanner:documentationHtml'
604+
]);
605+
555606
// Production
556607
// ---------------------------------------------
557608

@@ -561,7 +612,7 @@ module.exports = function (grunt) {
561612
'less:' + component,
562613
'autoprefixer:' + component,
563614
'cssmin:' + component,
564-
'concat:' + component
615+
'usebanner:' + component
565616
]);
566617
}
567618
if (component == undefined) {

app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/_dashboard.less

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Dashboard
88
// _____________________________________________
99

10-
@dashboard__font-size-base: 1.3rem;
10+
@dashboard__font-size__base: 1.3rem;
1111
@dashboard__font-size-l: 2.4rem;
1212
@dashboard-tabs__padding: 2rem;
1313
@dashboard-tabs__background-color: @color-white;
@@ -18,7 +18,7 @@
1818

1919
.dashboard-data {
2020
background: @dashboard-tabs__background-color;
21-
font-size: @dashboard__font-size-base;
21+
font-size: @dashboard__font-size__base;
2222
width: 100%;
2323
th,
2424
td {
@@ -87,7 +87,7 @@
8787
.dashboard-container {
8888
.empty-text {
8989
background: @dashboard-tabs__background-color;
90-
font-size: @dashboard__font-size-base;
90+
font-size: @dashboard__font-size__base;
9191
}
9292
}
9393

@@ -148,13 +148,13 @@
148148

149149
.dashboard-totals-label {
150150
display: block;
151-
font-size: @dashboard__font-size-base;
152-
font-weight: @font-weight-bold;
151+
font-size: @dashboard__font-size__base;
152+
font-weight: @font-weight__bold;
153153
}
154154

155155
.dashboard-totals-value {
156156
font-size: @dashboard__font-size-l;
157-
font-weight: @font-weight-semibold;
157+
font-weight: @font-weight__semibold;
158158
}
159159

160160
//
@@ -169,8 +169,8 @@
169169
.background-gradient(
170170
@_background-gradient: true,
171171
@_background-gradient-direction: horizontal,
172-
@_background-gradient-start-color: rgba(255,255,255,0),
173-
@_background-gradient-end-color: @color-white,
172+
@_background-gradient-color-start: rgba(255,255,255,0),
173+
@_background-gradient-color-end: @color-white,
174174
@_background-gradient-color-position: false
175175
);
176176
content: '';
@@ -218,7 +218,7 @@
218218

219219
.dashboard-item-title {
220220
font-size: 1.8rem;
221-
font-weight: @font-weight-bold;
221+
font-weight: @font-weight__bold;
222222
}
223223

224224
.dashboard-item-primary {
@@ -231,14 +231,14 @@
231231

232232
.dashboard-sales-value {
233233
font-size: @dashboard__font-size-l;
234-
font-weight: @font-weight-semibold;
234+
font-weight: @font-weight__semibold;
235235
}
236236

237237
//
238238
// Mobile
239239
// _____________________________________________
240240

241-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen-m) {
241+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
242242

243243
//
244244
// Totals: Revenue, Tax, Shipping, Quantity

app/design/adminhtml/Magento/backend/Magento_Theme/web/css/source/module.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ body {
4343
min-height: 100%;
4444
width: 100%;
4545
max-width: 100%;
46-
min-width: @layout-min-width + 2 * @layout-indent;
46+
min-width: @layout__min-width + 2 * @layout-indent__width;
4747
& > * {
4848
.vendor-prefix-flex-grow(0);
4949
.vendor-prefix-flex-shrink(0);
@@ -397,7 +397,7 @@ body {
397397
border-radius: 10px;
398398
vertical-align: middle;
399399
.icon-font(
400-
@_icon-font: @font-family-base,
400+
@_icon-font: @font-family__base,
401401
@_icon-font-content: '?',
402402
@_icon-font-size: 13px,
403403
@_icon-font-line-height: 16px,

app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/_module.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// * See COPYING.txt for license details.
44
// */
55

6-
//@import "formelements.less";
6+
//@import 'formelements';

app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/formelements.less

+12-12
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
@field-label_required--color: #EB5202;
1414
@field-note--color: #303030;
1515
@field-control--color: #303030;
16-
@field-control--bg-color: #fff;
17-
@field-control_disabled--bg-color: #E9E9E9;
16+
@field-control--background-color: #fff;
17+
@field-control_disabled--background-color: #E9E9E9;
1818
@field-control-addon--color: #858585;
1919
@field-date-icon--color: #514943;
2020
@field-tooltip-icon--color: #fff;
21-
@field-tooltip-icon--bg-color: #514943;
22-
@field-tooltip-content--bg-color: #fff8d7;
21+
@field-tooltip-icon--background-color: #514943;
22+
@field-tooltip-content--background-color: #fff8d7;
2323
@field-tooltip-content--border-color: #adadad;
2424
@field-error--color: #555;
25-
@field-error--bg-color: #FFF8D6;
25+
@field-error--background-color: #FFF8D6;
2626
@field-error--border-color: #E22626;
2727

2828

@@ -72,7 +72,7 @@
7272
width: 22px;
7373
text-align: center;
7474
color: @field-tooltip-icon--color;
75-
background-color: @field-tooltip-icon--bg-color;
75+
background-color: @field-tooltip-icon--background-color;
7676
}
7777
span {
7878
.visually-hidden();
@@ -87,7 +87,7 @@
8787
position: absolute;
8888
z-index: 1;
8989
width: 320px;
90-
background: @field-tooltip-content--bg-color;
90+
background: @field-tooltip-content--background-color;
9191
padding: 15px 25px;
9292
right: -66px;
9393
border: 1px solid @field-tooltip-content--border-color;
@@ -106,7 +106,7 @@
106106
z-index: 3;
107107
}
108108
&:after {
109-
border-top-color: @field-tooltip-content--bg-color;
109+
border-top-color: @field-tooltip-content--background-color;
110110
margin-top: -1px;
111111
z-index: 4;
112112
}
@@ -127,7 +127,7 @@
127127
display: block;
128128
margin: 2px 0 0;
129129
padding: 6px 10px 10px;
130-
background: @field-error--bg-color;
130+
background: @field-error--background-color;
131131
color: @field-error--color;
132132
font-size: 12px;
133133
font-weight: 500;
@@ -171,7 +171,7 @@
171171
color: @field-label-disabled--color;
172172
}
173173
&.field .control [class*="control-"][disabled] {
174-
background-color: @field-control_disabled--bg-color;
174+
background-color: @field-control_disabled--background-color;
175175
opacity: .5;
176176
color: @field-control--color;
177177
border-color: @field-control--border-color;
@@ -284,7 +284,7 @@
284284
border-radius: 1px;
285285
padding: 0 10px;
286286
color: @field-control--color;
287-
background-color: @field-control--bg-color;
287+
background-color: @field-control--background-color;
288288
font-weight: 500;
289289
font-size: 15px;
290290
min-width: 11em;
@@ -505,7 +505,7 @@
505505
}
506506
&[disabled] + label:before {
507507
opacity: .5;
508-
background: @field-control_disabled--bg-color;
508+
background: @field-control_disabled--background-color;
509509
}
510510
}
511511
}

app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module.less

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
@admin__color4: #666;
1414

1515
//Spacing
16-
@spacing-base: 10px;
17-
@spacing-xs: @spacing-base;
18-
@spacing-s: @spacing-base;
16+
@spacing__base: 10px;
17+
@spacing-xs: @spacing__base;
18+
@spacing-s: @spacing__base;
1919
@spacing-m: 15px;
20-
@spacing-l: @spacing-base;
21-
@spacing-xl: @spacing-base;
20+
@spacing-l: @spacing__base;
21+
@spacing-xl: @spacing__base;
2222

2323
//Fonts
24-
@size-base: 1rem;
25-
@size-xs: @size-base;
26-
@size-s: @size-base;
27-
@size-m: @size-base * 1.2;
28-
@size-l: @size-base;
29-
@size-xl: @size-base;
24+
@size__base: 1rem;
25+
@size-xs: @size__base;
26+
@size-s: @size__base;
27+
@size-m: @size__base * 1.2;
28+
@size-l: @size__base;
29+
@size-xl: @size__base;
3030

3131
[class*="tab-nav-item"]:not(ul):active,
3232
[class*="tab-nav-item"]:not(ul):focus {

app/design/adminhtml/Magento/backend/web/css/admin.less

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
/* Backend */
77

8-
@import "../less/styles/vars.less";
9-
@import "../less/styles/base.less";
10-
@import "../less/lib/buttons.less";
11-
@import 'source/lib/utilities.less';
8+
@import '../less/styles/vars';
9+
@import '../less/styles/base';
10+
@import '../less/lib/buttons';
11+
@import 'source/lib/_utilities';
1212

1313
.dont-use-this-class-big-size {
1414
font-size: 18px;

app/design/adminhtml/Magento/backend/web/css/source/_alerts.less

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// _____________________________________________
99

1010
// Colors
11-
@alert__bg-color: @color-lazy-sunny;
11+
@alert__background-color: @color-lazy-sunny;
1212
@alert__color: @color-gray20;
1313

1414
// Sizes
@@ -31,7 +31,7 @@
3131
}
3232

3333
.message {
34-
background: @alert__bg-color;
34+
background: @alert__background-color;
3535
color: @alert__color;
3636
margin-bottom: 3.5rem;
3737
padding: 1.8rem 4rem 1.8rem 1.9rem;
@@ -41,10 +41,10 @@
4141
&:before {
4242
background: none;
4343
border: 0;
44-
font-family: @icon-font-admin-name;
44+
font-family: @icon-font__admin-name;
4545
font-size: @alert__font-size;
46-
font-style: @font-style-regular;
47-
font-weight: @font-weight-regular;
46+
font-style: @font-style__base;
47+
font-weight: @font-weight__regular;
4848
height: auto;
4949
left: 1.9rem;
5050
line-height: inherit;

0 commit comments

Comments
 (0)