When trying to override AMP component styles using <style jsx />, changes made to classes generated by AMP are ignored and are not added to the CSS bundle.
First we insert an amp component like this into our JSX code:
<amp-carousel
type="carousel"
controls
className="carousel-blog"
height="65vh"
layout="fixed-height"
>
<div className="item">Item1</div>
<div className="item">Item2</div>
</amp-carousel>
This particular component generates the following css classes:
.amp-carousel-button.amp-carousel-button-prev.amp-carousel-button-nextThen if we try overriding them with a <style jsx />, like this:
<style jsx>{`
.amp-carousel-button {
background-color: transparent;
}
.carousel-blog {
height: 100%;
}
`}</style>
.amp-carousel-button is ignored and not added to the CSS bundle, even though it is inside the same style tag as .carousel-blog, which IS added to the bundle.
I expected the bundle generator to add the changes made to AMP classes written inside my <style jsx /> tags, since other classes used inside the same tags are indeed added.
I'm working with AMP-only mode.
The only way I was able to modify these classes was using an HTML style tag inside the _document.js file and using the dangerouslySetInnerHtml attribute.
If we could get some guidance on where to start with this issue, we would love to start contributing to next.js. Disclaimer: I am part of the same team as @Glomels
Most helpful comment
If we could get some guidance on where to start with this issue, we would love to start contributing to next.js. Disclaimer: I am part of the same team as @Glomels