简体   繁体   中英

Trying a scss file to css by using terminal, sass doesn't work

i'm learning html and i'm in the very beginning. i've written this variables.scss file and trying to turn css file. this is what i wrote to VS Code terminal: sass variables.scss:variables.css

and this is my error msg:

sass : The term 'sass' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included, verify  
that the path is correct and try again.
At line:1 char:1
+ sass variables.scss:variables.css
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (sass:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

i said okey, i just need to install sass i guess and write to the terminal: npm install -g node-sass

npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that    
the path is correct and try again.
At line:1 char:1
+ npm install -g node-sass
+ ~~~
    + CategoryInfo          : ObjectNotFound: (npm:String) [], CommandNotFoundException     
    + FullyQualifiedErrorId : CommandNotFoundException

sooo i have no idea what should i do or not (i tried other stuff also end up error msgs)

trying to variables.scss to turn css file.

  1. First, you need to download and install Node.js .
  2. Second, (as the screenshot looks like you are on Windows) ensure the path to the executable has been added to your environment variables .
  3. You may need to restart your computer after this for the changes to take effect.
  4. Run npm install -g sass in the terminal.
  5. Run sass variables.scss variables.css in the terminal.

As you are a beginner, you need to have best practices for use SASS in a projet because it will allow you to become autonomous. So, first of all, click NodeJS to dowload it. Next, to properly install SASS, here are some steps:

  1. Open your terminal in VSCode and write: npm install -g sass .
  2. Look for the Live Sass Compiler (Glenn Marks) extension.
  3. Initialize a package.json file: npm init

Finally, click SASS to learn more about it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM