Using SCSS with Astro
3 min read
Adding SCSS to Astro
npm install sass
External SCSS File
That’s it.
Using SCSS in Astro Components
Remember to add lang="scss"
to <style></style>
.
Using Tailwindcss in Astro
npx astro add tailwind
Imported files instead of used. SCSS requires that @use
be at the very top of the page, but Tailwindcss over wrote my styles. I think it’s just @tailwind base;
.
Astro automagically rolls everything up (including component css) into an external css file. Freaking love Astro.
Removing Tailwind Base Styles
Tailwind Media Queries Reference
/*
min-width
sm - 640px - @media (min-width: 640px) { ... }
md - 768px - @media (min-width: 768px) { ... }
lg - 1024px - @media (min-width: 1024px) { ... }
xl - 1280px - @media (min-width: 1280px) { ... }
2xl - 1536px - @media (min-width: 1536px) { ... }
max-width
sm - 640px - @media (max-width: 640px) { ... }
md - 768px - @media (max-width: 768px) { ... }
lg - 1024px - @media (max-width: 1024px) { ... }
xl - 1280px - @media (max-width: 1280px) { ... }
2xl - 1536px - @media (max-width: 1536px) { ... }
*/