Document adding styles to your project
opened this issue · comments
What feature were you trying to use?
I wanted to import SASS files and CSS modules into my Slinkity project.
Where did our docs fail you?
I used Vite's documentation to figure out how SASS imports worked, since I couldn't find any resources on Slinkity's own documentation!
How can we improve?
I'd suggest adding a new page to the doc's main navigation called "styling." This page should contain a few topics:
- A brief overview of 11ty's passthrough copy options. This is used to copy any asset (including styles) to the build directory of your project. For instance, if you have a
styles
directory at the base of your project, you can copy over all the contents of that directory usingeleventyConfig.addPassthroughCopy('styles')
- **How to add
css
,scss
,sass
,less
, and more to existing pages usinglink
tags. A powerful example would be: open any base layout you haven your project, and add a link tag referencing a file in your build output. For instance, if you had aheading.scss
in thatstyles
folder you passthrough copied, you can use it on any page using<link rel="stylesheet" href="/styles/heading.scss">
. Yes, you can just say.scss
! Vite knows what to do with it. - How to use CSS modules in component files. It's as simple as importing these styles from literally anywhere like so:
import styles from './styles/heading.module.css'
. Funny enough, you don't even need to passthrough copy CSS modules to the build output! Wherever these files live, styles will get applied correctly. - Anything else I'm missing here!