Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit d0f06a6

Browse files
traviskaufmancristobalchao@google.com
authored andcommitted
fix(select): Ensure disabled styles render correctly (#286)
- Fix @include directive for disabled styles that was used within the context of a multiple selector, which was emitting incorrect styles. - Fix our webpack config to emit our stylesheets correctly, while also removing LoaderOptions which is apparently deprecated - (tech debt) Update stylelint-scss and postcss-loader - (tech debt) Remove prod dependency on stylelint-scss which shouldn't have been there in the first place Fixes #276
1 parent fc57a6e commit d0f06a6

File tree

3 files changed

+36
-42
lines changed

3 files changed

+36
-42
lines changed

package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"mkdirp": "^0.5.1",
6060
"node-sass": "^3.7.0",
6161
"npm-run-all": "^2.3.0",
62-
"postcss-loader": "^0.9.1",
62+
"postcss-loader": "^1.2.2",
6363
"raw-loader": "^0.5.1",
6464
"sass-loader": "^4.1.1",
6565
"semver": "^5.3.0",
@@ -69,7 +69,7 @@
6969
"stylelint": "^7.8.0",
7070
"stylelint-config-standard": "^16.0.0",
7171
"stylelint-order": "^0.2.2",
72-
"stylelint-scss": "^1.2.1",
72+
"stylelint-scss": "^1.4.1",
7373
"stylelint-selector-bem-pattern": "^1.0.0",
7474
"tape": "^4.6.0",
7575
"testdouble": "^1.6.0",
@@ -105,8 +105,5 @@
105105
"commitizen": {
106106
"path": "./node_modules/cz-conventional-changelog"
107107
}
108-
},
109-
"dependencies": {
110-
"stylelint-scss": "^1.4.1"
111108
}
112109
}

packages/mdc-select/mdc-select.scss

+8-4
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@
121121
pointer-events: none;
122122
// Imitate native disabled functionality
123123
user-select: none;
124+
}
124125

125-
@include mdc-theme-dark(".mdc-select", true) {
126-
@include mdc-theme-prop(color, text-disabled-on-dark);
127-
@include mdc-select-dd-arrow-svg-bg_(ffffff, .38);
126+
@each $sel in ("mdc-select--disabled", "mdc-select[disabled]") {
127+
.#{$sel} {
128+
@include mdc-theme-dark(".mdc-select", true) {
129+
@include mdc-theme-prop(color, text-disabled-on-dark);
130+
@include mdc-select-dd-arrow-svg-bg_(ffffff, .38);
128131

129-
border-bottom: 1px dotted rgba(white, .38);
132+
border-bottom: 1px dotted rgba(white, .38);
133+
}
130134
}
131135
}
132136

webpack.config.js

+26-33
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ if (LIFECYCLE_EVENT == 'test' || LIFECYCLE_EVENT == 'test:watch') {
4646
process.env.BABEL_ENV = 'test';
4747
}
4848

49+
const CSS_LOADER_CONFIG = [
50+
{
51+
loader: 'css-loader',
52+
options: {
53+
sourceMap: true,
54+
},
55+
},
56+
{
57+
loader: 'postcss-loader',
58+
options: {
59+
plugins: () =>[require('autoprefixer')({grid: false})],
60+
},
61+
},
62+
{
63+
loader: 'sass-loader',
64+
options: {
65+
sourceMap: true,
66+
includePaths: glob.sync('packages/*/node_modules').map((d) => path.join(__dirname, d)),
67+
},
68+
},
69+
];
70+
4971
module.exports = [{
5072
name: 'js-components',
5173
entry: {
@@ -145,43 +167,14 @@ module.exports = [{
145167
module: {
146168
rules: [{
147169
test: /\.scss$/,
148-
use: IS_DEV ? [{
149-
loader: 'style-loader',
150-
},
151-
{
152-
loader: 'css-loader',
153-
options: {
154-
sourceMap: true,
155-
},
156-
},
157-
{
158-
loader: 'postcss-loader',
159-
},
160-
{
161-
loader: 'sass-loader',
162-
options: {
163-
sourceMap: true,
164-
},
165-
}] : ExtractTextPlugin.extract('css-loader!postcss-loader!sass-loader'),
170+
use: IS_DEV ? [{loader: 'style-loader'}].concat(CSS_LOADER_CONFIG) : ExtractTextPlugin.extract({
171+
fallback: 'style-loader',
172+
use: CSS_LOADER_CONFIG,
173+
}),
166174
}],
167175
},
168176
plugins: [
169177
new ExtractTextPlugin('[name].' + (IS_PROD ? 'min.' : '') + 'css'),
170178
createBannerPlugin(),
171-
new webpack.LoaderOptionsPlugin({
172-
debug: true,
173-
options: {
174-
context: __dirname,
175-
output: {
176-
path: OUT_PATH,
177-
},
178-
postcss: {
179-
plugins: () =>[require('autoprefixer')({grid: false})],
180-
},
181-
sassLoader: {
182-
includePaths: glob.sync('packages/*/node_modules').map((d) => path.join(__dirname, d)),
183-
},
184-
},
185-
}),
186179
],
187180
}];

0 commit comments

Comments
 (0)