profile
viewpoint

Ask questionsRequest for Expert Mode. Or at least a more granular/controllable Tree-Shaking

Options – Not decisions

I have recently encountered the problem of being limited by the tree-shaking mechanisms of the amp-plugin.

It seems to like to remove some more complicated selectors, which I happen to need. I assume that the Tree-shaker might might not exactly get that I need those classes and definitions.

Nevertheless: What I personally would prefer, would be a slightly more granular developer edition of the plugin. Where we could actually control more precisely how AMP is enforced...

My primary use case for the plugin has been the suppression of custom JS/CSS by plugins. Nowadays – in light of being a good citizen – i took care of that myself, in order to get the system slightly better optimized anyway.

So basically I need it for things like WP Forms-Integration...

I could imagine that more savvy developers/designers than me might find the suggestion useful. It would be for people who know what they are doing (and me) …

The plugin is really great… I have used it already on multiple sites. We are using AMP by now almost anywhere we can.

Cheers Martin


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • <!-- One or more bullet points for acceptance criteria. -->

Implementation brief

  • <!-- One or more bullet points for how to technically resolve the issue. For significant Implementation Design, it is ok use a Google document accessible by anyone. -->

QA testing instructions

  • <!-- One or more bullet points to describe how to test the implementation in QA. -->

Demo

  • <!-- A video or screenshots demoing the implementation. -->

Changelog entry

  • <!-- One sentence summarizing the PR, to be used in the changelog. -->
ampproject/amp-wp

Answer questions westonruter

Your CSS is using a class selector .chide but there is no such class in the HTML.

I would love to prevent AMPlification on already AMP-centric components which were done via a custom Gutenberg-component. ¶ If I write e.g. a dedicated component with amp-video or amp-img component inside, I get amp errors in the backend, which I have to tell my clients to ignore...

I'm not sure I understand. If you're already using AMP-centric (AMP-compatible) components, then “AMPification” would be just passing through the markup without making changes. If you are getting errors, then apparently you're not writing valid AMP. What errors are being reported? Are they related to using “transformed” AMP as the input? Elements, attributes, and class names that start with i-amphtml- are not allowed in normal AMP documents. To avoid markup causing validation errors in the AMP plugin, make sure that it also avoids validation errors when being pasted into https://validator.amp.dev

useful!

Related questions

URL validation failed to due to the absence of the expected JSON-containing AMP_VALIDATION comment after the body. hot 1
URL validation failed to due to the absence of the expected JSON-containing AMP_VALIDATION comment after the body. hot 1
Github User Rank List