Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored and astrobot-houston committed Jan 23, 2023
1 parent 7325df4 commit 12a10fe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/astro/e2e/css-sourcemaps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ test.describe('CSS Sourcemap HMR', () => {
test.skip(isWindows, 'TODO: fix css hmr in windows');

test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
const html = await astro.fetch('/').then(res => res.text());
const html = await astro.fetch('/').then((res) => res.text());

// style[data-astro-dev-id] should exist in initial SSR'd markup
expect(html).toMatch('data-astro-dev-id');

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/e2e/css.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ test.describe('CSS HMR', () => {
});

test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
const html = await astro.fetch('/').then(res => res.text());
const html = await astro.fetch('/').then((res) => res.text());

// style[data-astro-dev-id] should exist in initial SSR'd markup
expect(html).toMatch('data-astro-dev-id');

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function getScriptsAndStyles({ env, filePath }: GetScriptsAndStylesParams)
props: {
type: 'text/css',
// Track the ID so we can match it to Vite's injected style later
'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root))
'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root)),
},
children: content,
});
Expand Down
6 changes: 5 additions & 1 deletion packages/astro/src/runtime/client/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@ function isStyle(node: Node): node is HTMLStyleElement {
}

function isViteInjectedStyle(node: Node): node is HTMLStyleElement {
return isStyle(node) && node.getAttribute('type') === 'text/css' && !!node.getAttribute('data-vite-dev-id');
return (
isStyle(node) &&
node.getAttribute('type') === 'text/css' &&
!!node.getAttribute('data-vite-dev-id')
);
}

0 comments on commit 12a10fe

Please sign in to comment.