This is an example Vite project using Lit 2, Typescript, and SASS imports.
- Changed Lit 1 implementation to Lit 2
- Added the
rollup-plugin-postcss-lit
plugin tovite.config.ts
npm i -D sass
- Added
typings/scss.d.ts
- Moved styles from
src/my-element.ts
tosrc/my-element.scss
and imported them - Added the
typings
folder totsconfig.json
- Added
"skipLibCheck": true
totsconfig.json
to override Vite's.scss
file typings
N.B. Since Lit does not yet handle HMR, Vite triggers a full reload for Lit files, but SASS files currently only trigger an hot module reload (HMR) which will not update Lit without manually triggering a reload. Follow this issue for more details or wait until Lit HMR is released.