Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow finer-grained control of emitted CSS #4227

Open
27 of 35 tasks
kfranqueiro opened this issue Jan 4, 2019 · 2 comments
Open
27 of 35 tasks

Allow finer-grained control of emitted CSS #4227

kfranqueiro opened this issue Jan 4, 2019 · 2 comments

Comments

@kfranqueiro
Copy link
Contributor

kfranqueiro commented Jan 4, 2019

In the past, we've received requests (such as #3357) for ways to better control what CSS is output by MDC Web. Being able to more granularly control what CSS we output also has the potential to help prospective framework wrappers that also want to govern output styles.

To this end, @mmalerba has worked on a prototype which would allow selectively including MDC Web's styles either all at once or piece-by-piece, with the ability to request the following subsets:

  • base ("structure") - anything that doesn't fall into one of the more specific subsets
  • mdc-theme-dependent ("color")
  • typography
  • animation

Miles' POC, along with a bit of fine-tuning and infrastructure work, is in #4228.

The end result of this is that existing usage of MDC Web will behave exactly the same - no existing mixin APIs change, nor does the output CSS if you continue to import @material/foo/mdc-foo. But you will also have the option of @include mdc-foo(...) and specifying a query of one or more subsets of the component's styles.

Since these changes are intended to be fully backwards-compatible, we can merge these PRs to master one by one. We should also be able to check CSS output on master vs. on the branch and verify that the results are the same (run npm run build on each one and move the folder somewhere to be diffed afterwards).

The following components have emitted styles that will need to be converted:

As with #4225, it may be best to leave textfield-related things until last:

  • mdc-floating-label
  • mdc-notched-outline
  • mdc-line-ripple
  • mdc-select
  • mdc-textfield

Bear in mind that some of these may have cross-dependencies, which will require at least partial conversions of other packages as well, so I've attempted to front-load any likely dependencies as possible (I think ripple is really the main one, and that's already been largely tackled as far as it needs to be for other components to use it). The first PR converts button fully, and ripple partially (mostly).

We should skip the following since they're deprecated (and likely to be removed as part of #4225):

  • mdc-icon-toggle
  • mdc-tabs
  • mdc-toolbar
@nemethmik
Copy link

I have spent a week or so on evaluating the possibility to apply MDC Web directly or MDC React in my mobile-first application. My impression is that because of this excessive use of SCSS the entire MDC Web is an implementation of MD mainly for static websites. It is not really OK for highly dynamic mobile applications, because the nature of SCSS. For example, to define the colors, themes or the number of columns for an image list in MDC Web, you can do that only fiddling with SCSS. This is really unacceptable for mobile app development. I think framework should hide the intricacies of SCSS/CSS. So, my question is that are you planning to replace SCSS with a more flexible, runtime, dynamic styling technology? Is this the reason you have ejected thee MDC Web components?

@jasonkylefrank
Copy link

To expand on what @nemethmik brought up, I'm curious if your team has considered using a CSS-in-JS approach for styles (e.g., JSS)? If not for MDC-Web, what about for MDC-Web-React (e.g., Styled Components)?

I'm starting to get the feeling that SASS may not be the strongest overall styling approach these days (and could address some of the points that @nemethmik brought up), but I'd like to hear your thoughts.

mmalerba added a commit to mmalerba/material-components-web that referenced this issue Mar 19, 2019
mmalerba added a commit to mmalerba/material-components-web that referenced this issue Mar 20, 2019
@abhiomkar abhiomkar added this-Q and removed backlog labels Apr 19, 2019
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 2, 2019
Adds support for style feature targeting to the `slider` package.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 4, 2019
Adds support for feature targeting to the `mdc-snackbar` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 6, 2019
Adds support for feature targeting to the mdc-drawer styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 6, 2019
Adds support for feature targeting to the `mdc-drawer` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 8, 2019
Adds support for feature targeting to the `mdc-snackbar` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 10, 2019
Adds support for feature targeting to the `mdc-drawer` styles.

Relates to material-components#4227.
@abhiomkar abhiomkar removed this from the April 22 Release milestone Jul 10, 2019
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 11, 2019
Adds support for style feature targeting to the `slider` package.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 11, 2019
Adds support for style feature targeting to the `slider` package.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jul 12, 2019
Adds support for feature targeting to the mdc-linear-progress styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Aug 19, 2019
Adds support for feature targeting to the mdc-linear-progress styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Sep 5, 2019
Adds support for feature targeting to the mdc-linear-progress styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Nov 28, 2019
Adds support for feature targeting to the `mdc-floating-label` styles.

Relates to material-components#4227.
crisbeto pushed a commit to crisbeto/material-components-web that referenced this issue Nov 29, 2019
Adds support for feature targeting to the `mdc-notched-outline` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Nov 29, 2019
Adds support for feature targeting to the `mdc-notched-outline` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Nov 30, 2019
Adds support for feature targeting to the `mdc-line-ripple` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Dec 6, 2019
Adds support for feature targeting to the `mdc-notched-outline` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Dec 6, 2019
Adds support for feature targeting to the `mdc-floating-label` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Dec 18, 2019
Adds support for feature targeting to the `mdc-floating-label` styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Dec 22, 2019
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Dec 22, 2019
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jan 10, 2020
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jan 10, 2020
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jan 11, 2020
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jan 16, 2020
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jan 17, 2020
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
crisbeto added a commit to crisbeto/material-components-web that referenced this issue Jan 19, 2020
Sets up feature targeting for the text field and its related styles.

Relates to material-components#4227.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants