-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Themes - Remove site-specific attributes from block markup #82047
Comments
Hi @Automattic/t-rex and @Automattic/lego, what are your thoughts on how to accomplish this task? We know how easily these attributes can break blocks and mess up templates after theme activation or break theme previews on the onboarding and theme showcase. |
@miksansegundo Maybe I'm missing something but isn't there already works on it via WordPress/wordpress-develop#3899?
Ah really? I thought the "canonical" way is to always export the final theme files from the Editor. |
@fushar, have a look at these threads:
|
I asked about the Themers workflow after a theme is exported in p1695973345286369/1694095271.631269-slack-C029FM1EH |
Sorry, I missed the Slack links that are already mentioned in the issue description 🤦 Okay, I get the full picture now. I like the idea of a pre-commit hook. Maybe a stronger solution is to set up a GitHub action that blocks a PR when it still has site-specific attributes. (I think a pre-commit hook can still be bypassed manually by devs; it's not 100% safe.) Regardless, do you have already any plan on how to detect the attributes? I'm assuming we want to do some regex trickery here. 😄 |
👋 Thanks so much for looking into this ahead of any of these issues being addressed in Core. This will be a massive help to our Themers.
This list looks good and covers all the site-specific attributes listed here, which is my best reference for this at the moment.
This sounds like a good plan, either using the
I'm a fan of pre-commit hooks and I'd suggest adding rules via
I'm also in favour of this idea, either as well as or instead of the pre-commit lint rules. We also check things like if a GlotPress project has been created for a theme pre-deployment, so I think a remove-attributes script would fit in well around that workflow. |
My thoughts (and I have no specific knowledge of these issues) is that CBT/GB should handle this as far as possible because that's where the files come from, and what the community will use. If the attributes can be reintroduced from elsewhere then it'd also be helpful if we had some git scripts to detect these issues and prevent them, and where possible a script to fix them once they are found. |
Also tracked in WordPress/create-block-theme#162 |
It's already on Pixel's team board marked as a high priority. |
Related WordPress/create-block-theme#162 Automattic/themes#6855
What
Remove the following site-specific attributes:
ref
attributes from the Navigation blockid
attributes from Image and Cover blockswp-image-[id]
classes from Image and Cover blockstaxQuery
attribute from query blocksThis doesn't break anything. See Theme Export: Strip out site specific details WordPress/gutenberg#42730 (comment)queryId
attributes from Query blockWhy
These attributes break themes because the values of these attributes are IDs that exist only on the site used as a development environment when developing a theme.
See p1694095271631269-slack-C029FM1EH and p1693893212165259-slack-C029FM1EH
How
wpcom-pub-themes
,wpcom-a8c-themes
, andwpcom-premium-themes
repos?The text was updated successfully, but these errors were encountered: