- Setup
- Introduction
- Basics
- Layouts
- Snippets
- inside your project directory, run
npm init -y && npm pkg set type="module"
without build tools
npm i -g sass
sass -w input.scss output.css
running on the terminal- vscode plugin liveserver from
index.html
with vite
npm i -g vite sass
- to index.html, add link:css with href=
path/to/main.scss
orapp.scss
vite run dev
- OR run
vite run build
then liveserver plugin
- OR run
Notes for vite setup
-
to avoid sass warning messages, add this config to
vite.config.js
import { defineConfig } from 'vite' export default defineConfig({ css: { preprocessorOptions: { scss: { api: "modern" } } } })
import { defineConfig } from 'vite'
// this is for editor's intellisenseapi: "modern"
// vite's options not part of sass-cli, the default is set to"legacy"
- other options used in vite to config sass, like
quietDeps:true
is actually--quiet-deps
from the sass cli, check sass official docs accordingly.
-
package.json
should havetype="module"
to avoid warning messages from vite