-
Notifications
You must be signed in to change notification settings - Fork 383
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
Tree shaker removes CSS style rules for amp-date-picker classes #4334
Comments
This comment has been minimized.
This comment has been minimized.
Approach Hi @westonruter, But when you have a chance, what do you think about:
It looks like the amp-date-picker documentation encourages styling many classes:
And the component in react-dates looks to have a lot of classes, probably more than we could keep track of in a PHP file. They're the PascalCase classes:
Maybe this would be applied in:
Thanks, Weston! |
This would be only a partial solution. We can support all the class names.
We wouldn't need to keep track of every one. We'd just need to keep track of the ones that have a common prefix corresponding to the component names seen here: https://github.com/airbnb/react-dates/tree/master/src/components For example, we only need to see if a class name starts with
This wouldn't need to be addressed in this issue. |
Nice, thanks for looking at this, and for your really fast reply. |
This is probably a small. |
Build for testing: amp.zip (v1.5.0-alpha-20200316T170457Z-c6b132818) |
Nice, thanks! |
Bug Description
As reported in the support forum, styling the
amp-date-picker
component is difficult because style rules that target classes which the component adds via JS are removed by the tree-shaker. For example:A workaround is to ensure that all CSS selectors have an
amp-date-picker
ancestor prefix, and then to add this plugin code:Expected Behaviour
If an
amp-date-picker
is on the page, all of the class names that can be used in anamp-date-picker
should be considered exempt from tree-shaking.Steps to reproduce
Create a Custom HTML block with the following contents:
View the AMP version of the page and notice that the date picker header does not have the expected gradient.
Screenshots
Expected:
Actual:
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: