Tailwind thing

This commit is contained in:
Matthew Phillips 2022-09-14 11:37:26 -04:00
parent c5e134d035
commit 24f3212a21
5 changed files with 69 additions and 1 deletions

View file

@ -150,5 +150,22 @@ describe('Scripts (hoisted and not)', () => {
});
expect(found).to.equal(1);
});
it.only('Using injectScript does not interfere', async () => {
let res = await fixture.fetch('/inline-in-page');
let html = await res.text();
let $ = cheerio.load(html);
//console.log(html);
let found = 0;
let moduleScripts = $('[type=module]');
moduleScripts.each((i, el) => {
if (
$(el).attr('src').includes('?astro&type=script&index=0&lang.ts')
) {
found++;
}
});
expect(found).to.equal(1);
});
});
});

View file

@ -0,0 +1,36 @@
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
export default defineConfig({
integrations: [
tailwind()
// {
// name: '@test-inject-script',
// hooks: {
// 'astro:config:setup'({ injectScript, updateConfig }) {
// injectScript('page-ssr', `import 'virtual:test';`);
// updateConfig({
// vite: {
// plugins: [
// {
// name: '@test-inject-script',
// resolveId(id) {
// if(id === 'virtual:test') {
// return id;
// }
// },
// load(id) {
// if(id === 'virtual:test') {
// console.log('loading it');
// return 'export default void 0;'
// }
// }
// }
// ]
// }
// })
// }
// }
// }
]
})

View file

@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
"astro": "workspace:*",
"@astrojs/tailwind": "workspace:*"
}
}

View file

@ -0,0 +1,12 @@
<html>
<head>
<title>Testing</title>
</head>
<body>
<h1>Testing</h1>
<script>
console.log('hi');
</script>
</body>
</html>

View file

@ -1356,8 +1356,10 @@ importers:
packages/astro/test/fixtures/astro-scripts:
specifiers:
'@astrojs/tailwind': workspace:*
astro: workspace:*
dependencies:
'@astrojs/tailwind': link:../../../../integrations/tailwind
astro: link:../../..
packages/astro/test/fixtures/astro-sitemap-rss: