Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/itchy-lobsters-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/compiler': patch
---

Change the value of the generated attribute
2 changes: 1 addition & 1 deletion internal/printer/printer_css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestPrinterCSS(t *testing.T) {
<h1 class="title">Page Title</h1>
<p class="body">I’m a page</p>`,
scopedStyleStrategy: "attribute",
want: ".title[data-astro-hash-DPOHFLYM]{font-family:fantasy;font-size:28px}.body[data-astro-hash-DPOHFLYM]{font-size:1em}",
want: ".title[data-astro-cid-DPOHFLYM]{font-family:fantasy;font-size:28px}.body[data-astro-cid-DPOHFLYM]{font-size:1em}",
},
}

Expand Down
2 changes: 1 addition & 1 deletion internal/transform/scope-html.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func injectScopedClass(n *astro.Node, opts TransformOptions) {
})
} else {
n.Attr = append(n.Attr, astro.Attribute{
Key: fmt.Sprintf(`data-astro-hash-%s`, opts.Scope),
Key: fmt.Sprintf(`data-astro-cid-%s`, opts.Scope),
Type: astro.EmptyAttribute,
})
}
Expand Down
8 changes: 4 additions & 4 deletions internal/transform/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func transformScopingFixtures() []struct {
<style>.class{}</style>
<div />
`,
want: `<div data-astro-hash-XXXXXX></div>`,
want: `<div data-astro-cid-XXXXXX></div>`,
scopeStyle: "attribute",
},
{
Expand All @@ -148,7 +148,7 @@ func transformScopingFixtures() []struct {
<style>.font{}</style>
<div />
`,
want: `<div data-astro-hash-XXXXXX></div>`,
want: `<div data-astro-cid-XXXXXX></div>`,
scopeStyle: "attribute",
},
{
Expand All @@ -157,7 +157,7 @@ func transformScopingFixtures() []struct {
<style>.font{}</style>
<div />
`,
want: `<div data-astro-hash-XXXXXX></div>`,
want: `<div data-astro-cid-XXXXXX></div>`,
scopeStyle: "attribute",
},
{
Expand All @@ -166,7 +166,7 @@ func transformScopingFixtures() []struct {
<style>.font{}</style>
<div class="foo" />
`,
want: `<div class="foo" data-astro-hash-XXXXXX></div>`,
want: `<div class="foo" data-astro-cid-XXXXXX></div>`,
scopeStyle: "attribute",
},
}
Expand Down
2 changes: 1 addition & 1 deletion lib/esbuild/css_printer/astro_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (p *printer) printScopedSelector() bool {
if p.options.ScopeStrategy == ScopeStrategyWhere {
str = fmt.Sprintf(":where(.astro-%s)", p.options.Scope)
} else if p.options.ScopeStrategy == ScopeStrategyAttribute {
str = fmt.Sprintf("[data-astro-hash-%s]", p.options.Scope)
str = fmt.Sprintf("[data-astro-cid-%s]", p.options.Scope)
} else {
str = fmt.Sprintf(".astro-%s", p.options.Scope)
}
Expand Down