2

I have scss and css files in ASP.NET project.

screenshot

If I change scss, should be css be regenerated? If yes, then how? VS can do this or should I have some other tool?

1 Answer 1

6

There are extensions that allow you to regenerate from inside Visual Studio, but I personally prefer the command line way.

sass --watch [folder holding .scss files]:[folder holding .css files]

If you use Compass, you can use this command instead:

compass watch

Both of these commands will tell Sass to watch the folder with the .scss files, and any time they're changed and saved, regenerate the CSS files.

If you created the project, then you likely already have Sass (and, by extension, Ruby) installed. If you don't, you'll need to install Ruby and Sass. Windows has a nice little installer that installs both Ruby and RubyGems. Once it's installed, you'll need to run the following to install Sass:

gem install sass

Once Sass is installed, you can either run the sass --watch command, or use a VS extension of your choice to watch and recompile the CSS files.

Sign up to request clarification or add additional context in comments.

7 Comments

so, to get VS extension, I need to install Ruby?
@Alex - If the extension is just a GUI for the Ruby Sass (instead of implementing its own scss compiler), then yes, you will. It's kind of like needing to install the .Net 4/4.5 in order to make use of the latest Entity Framework or LINQ capabilities.
okay, installed Ruby and Sass. How I can run VS extension or should I run sass --watch anyway?
How you run the VS extension depends on the extension you install. You'll have to consult the extension's documentation. As I said, I personally don't bother with a VS extension for Sass and just run the terminal command, but it ultimately comes down to your preferred workflow.
Then yes, you'll need to install an extension. I can't recommend one, though, since I don't use any. You should be able to find some good ones in Visual Studio's extension library
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.