#Questions

1 messages · Page 1 of 1 (latest)

spark prism
#

There are some questions needed to be answered and we are here to help vite

#

how do i compiler scss to css

#

from vite.config.file

vital cairn
#

npm add -D sass

and then import your scss file in your js file

#

for example if your HTML has a script <script src="path/to/your/index.js"></script> then in your index.js import scss with import 'path/to/your/styles.scss'. So Vite should automatically detect it and compile it to CSS on build.

spark prism
#

how come yours work and mine doesent

#

or you mean it only works after running vite build command?

spark prism
#

i want it to readload css on every save

vital cairn
vital cairn
spark prism
#

sorry im late to post this as im having my final exams

#

here

#

wait i cannot post image here

#
utils
  ---index.js
  ---main-image.png
  ---style.scss
index.html

my folder structure now in index.js

import './style.scss';
``` only thing which is written

in index.html
```html
at the bottom of body

<script src="./utils/index.js"></script>
vital cairn
#

For example

<script type="module" src="src/js/index.js"></script>

spark prism
#

how about i put that in my package.json?

vital cairn
#

It should be there by default, as far as I remember.

spark prism
#

there is not

#

after adding type module it works

#

but i want to to work without it

vital cairn
#

Why?

spark prism
#

why not ?

spark prism
#

another question but its not related not vite

#

hows do you version your package .jdon

#

json

spark prism
#

What is the usage of vite.config.js file

vital cairn
spark prism
#

Oh

#

Btw what is the usebof vote.config.ja

#

Js*

spark prism
#

Vite.config.js*

vital cairn
#

Vite configurations as well as Rollup configs.

jaunty galleon
vital cairn
#

You can use rollup configs in your Vite configs.

#

Just specifiy a new object property for build called rollupOptions.