Skip to content

Commit 18159c5

Browse files
committed
build: replace gulp-autoprefixer
* Removes `gulp-autoprefixer` in order to avoid issues with Google's internal build system. * Switches to adding vendor prefixes via SCSS mixins. * Adds a custom Stylelint plugin that utilizies Autoprefixer to find unprefixed properties, values, @rules etc. Fixes #3536.
1 parent cdb3763 commit 18159c5

File tree

14 files changed

+198
-31
lines changed

14 files changed

+198
-31
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@types/node": "^7.0.5",
5252
"@types/run-sequence": "^0.0.28",
5353
"@types/rx": "2.5.33",
54+
"autoprefixer": "^6.7.6",
5455
"axe-core": "^2.1.7",
5556
"axe-webdriverjs": "^0.5.0",
5657
"conventional-changelog": "^1.1.0",
@@ -62,7 +63,6 @@
6263
"glob": "^7.1.1",
6364
"google-cloud": "^0.48.0",
6465
"gulp": "^3.9.1",
65-
"gulp-autoprefixer": "^3.1.1",
6666
"gulp-better-rollup": "^1.0.2",
6767
"gulp-clean": "^0.3.2",
6868
"gulp-clean-css": "^3.0.3",

src/demo-app/ripple/ripple-demo.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
text-align: center;
1515
transition: all 200ms linear;
1616
width: 200px;
17-
user-select: none;
1817

1918
&.demo-ripple-disabled {
2019
color: rgba(32, 32, 32, 0.4);
@@ -32,4 +31,4 @@
3231
.demo-ripple-checkbox-option {
3332
margin: 10px 0;
3433
}
35-
}
34+
}

src/lib/button-toggle/button-toggle.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import '../core/a11y/a11y';
22
@import '../core/style/elevation';
3+
@import '../core/style/prefixes';
34
@import '../core/style/layout-common';
45

56
$mat-button-toggle-padding: 0 16px !default;
@@ -44,11 +45,11 @@ $mat-button-toggle-border-radius: 2px !default;
4445
}
4546

4647
.mat-button-toggle-label-content {
48+
@include user-select(none);
4749
display: inline-block;
4850
line-height: $mat-button-toggle-line-height;
4951
padding: $mat-button-toggle-padding;
5052
cursor: pointer;
51-
user-select: none;
5253
}
5354

5455
.mat-button-toggle-label-content > * {

src/lib/core/option/_option.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import '../style/menu-common';
2+
@import '../style/prefixes';
23
@import '../a11y/a11y';
34

45
/**
@@ -13,8 +14,8 @@
1314
outline: none;
1415

1516
&[aria-disabled='true'] {
17+
@include user-select(none);
1618
cursor: default;
17-
user-select: none;
1819
}
1920
}
2021

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
@import './prefixes';
2+
13
// Mixin overriding default button styles like the gray background, the border, and the outline.
24
@mixin mat-button-reset {
5+
@include user-select(none);
36
cursor: pointer;
4-
user-select: none;
57
outline: none;
68
border: none;
79
}

src/lib/core/style/_prefixes.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* stylelint-disable material/no-prefixes */
2+
@mixin user-select($value) {
3+
-webkit-user-select: none;
4+
-moz-user-select: none;
5+
-ms-user-select: none;
6+
user-select: none;
7+
}
8+
9+
@mixin placeholder {
10+
&::placeholder {
11+
@content;
12+
}
13+
14+
&::-moz-placeholder {
15+
@content;
16+
}
17+
18+
&::-webkit-input-placeholder {
19+
@content;
20+
}
21+
22+
&:-ms-input-placeholder {
23+
@content;
24+
}
25+
}
26+
27+
@mixin cursor-grab {
28+
cursor: -webkit-grab;
29+
cursor: grab;
30+
}
31+
/* stylelint-enable */

src/lib/input/input-container.scss

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,7 @@ $mat-input-underline-disabled-background-image:
109109
// Note that we can't use something like visibility: hidden or
110110
// display: none, because IE ends up preventing the user from
111111
// focusing the input altogether.
112-
&::placeholder {
113-
color: transparent;
114-
}
115-
&::-moz-placeholder {
116-
color: transparent;
117-
}
118-
&::-webkit-input-placeholder {
119-
color: transparent;
120-
}
121-
&:-ms-input-placeholder {
112+
@include placeholder {
122113
color: transparent;
123114
}
124115
}

src/lib/select/select.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@import '../core/style/list-common';
33
@import '../core/style/form-common';
44
@import '../core/style/variables';
5+
@import '../core/style/prefixes';
56
@import '../core/a11y/a11y';
67

78
$mat-select-trigger-height: 30px !default;
@@ -28,8 +29,8 @@ $mat-select-trigger-font-size: 16px !default;
2829
font-size: $mat-select-trigger-font-size;
2930

3031
[aria-disabled='true'] & {
32+
@include user-select(none);
3133
cursor: default;
32-
user-select: none;
3334
}
3435
}
3536

src/lib/slide-toggle/slide-toggle.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import '../core/style/variables';
22
@import '../core/ripple/ripple';
33
@import '../core/style/elevation';
4+
@import '../core/style/prefixes';
45
@import '../core/a11y/a11y';
56

67
$mat-slide-toggle-thumb-size: 20px !default;
@@ -25,7 +26,7 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
2526

2627
// Disable user selection to ensure that dragging is smooth without grabbing
2728
// some elements accidentally.
28-
user-select: none;
29+
@include user-select(none);
2930

3031
outline: none;
3132

@@ -100,7 +101,7 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
100101
transition: $swift-linear;
101102
transition-property: transform;
102103

103-
cursor: grab;
104+
@include cursor-grab;
104105

105106
// Once the thumb container is being dragged around, we remove the transition duration to
106107
// make the drag feeling fast and not delayed.

stylelint-config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2+
"plugins": [
3+
"./tools/stylelint/no-prefixes/no-prefixes.js"
4+
],
25
"rules": {
6+
"material/no-prefixes": [["last 2 versions", "not ie <= 10", "not ie_mob <= 10"]],
37
"color-hex-case": "lower",
48
"color-no-invalid-hex": true,
59

0 commit comments

Comments
 (0)