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

feat: add title attribute to Compiled style tag #1649

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pancaspe87
Copy link
Collaborator

TBH, I am not sure if this is a valuable change considering these devlop issues . Also, we know that classes starting with _ are usually Compiled; hence, we can just look for it.
However, it may save some keystrokes when debugging :)


Dev mode
It seems that we are having multiple style tags when extraction is not enabled, only one is getting the title attribute
Screenshot 2024-03-20 at 3 22 42 pm

VS

Prod mode
We can easily discern what style is for Compiled.
Screenshot 2024-03-20 at 3 22 01 pm

Copy link

changeset-bot bot commented Mar 20, 2024

🦋 Changeset detected

Latest commit: b2531bf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@compiled/parcel-optimizer Minor
@compiled/parcel-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -71,7 +71,7 @@ export default new Optimizer<ParcelOptimizerOpts, unknown>({
.use(
insertAt({
selector: 'head',
append: '<style>' + stylesheet + '</style>',
append: '<style title="compiled">' + stylesheet + '</style>',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, do we inline CSS also in webpack? I don't think I have seen inlineCss for it

@dddlr
Copy link
Collaborator

dddlr commented Mar 20, 2024

ooh good idea 👍 do you reckon it would be useful to also add this to the SSR styles that have the data-cmpld="true" attribute?

(perhaps we can use title="parcel-compiled" instead of title="compiled" to distinguish which plugin the styles are coming from?)

@JakeLane
Copy link
Collaborator

We already have some similar behaviour for the runtime, maybe we should match that?

@dddlr
Copy link
Collaborator

dddlr commented Mar 21, 2024

We already have some similar behaviour for the runtime, maybe we should match that?

hmm yeah maybe we could keep data-cmpld for the SSR stuff and have data-compiled-parcel for the @compiled/parcel-optimizer output? will let @pancaspe87 make the final call on the best name for this

(i'm reluctant to use data-cmpld for everything because of how data-cmpld is being used here

const ssrStyles = document.querySelectorAll<HTMLStyleElement>('style[data-cmpld]');
)

@pancaspe87
Copy link
Collaborator Author

Yeahh, I did see data-cmpld and thought it was specific to runtime.

TBH, I am happy to reuse data-cmpld or apply the same title='compiled' to everything . Whatever works best for you @JakeLane @dddlr @liamqma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants