Share via

Converting Scss to CSS and using in Asp.net MVC Core 6 (Issue)

mehmood tekfirst 771 Reputation points
May 30, 2022, 11:12 AM

I want to scss (sass) in my Asp.Net MVC Core 6 Application.

What I did is :

Navigated to wwwroot -> npm init

and generate a package.json

Install npm node-sass and then mention this command in package.json file

 "scripts": {  
    "sass": "node-sass styles/ -o css/",    
  },  

and run this command in the terminal npm run sass

after this command, there is a new css file generated within a wwwroot directory with the name of main.css

206734-image.png

206657-image.png

after that I referred this css file on my layout.cshtml.

I use both node-sass as well as sass.

the commands were different

sass command was

"sass": "sass -w styles:css",

But the result is same ,

I am wondering why my complete sass files and styles are not working ?

Am i missing something in it ?

206715-image.png

Please guide ASAP.

thank you

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,809 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 73,496 Reputation points
    May 30, 2022, 6:55 PM

    what does not working mean? sass appears to run and create a main.css which should be based on the main.scss. what in main.scss did not get generated in main.css?

    note: I would not typically put the node package in wwwroot (which is typically deployment only). I would put in a source and output to wwwroot.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.