Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing (.sass) in visual studio 2017

I'm just starting to use VS 2017 and i usually write .sass but turns out VS only recognise .scss files is there a way make VS recognise .sass files??

like image 232
moamenezzat Avatar asked Apr 02 '17 18:04

moamenezzat


1 Answers

There are (free) extensions available for Visual Studio 2017

One of them is Web Compiler : https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebCompiler

You can install it inside Visual Studio IDE

Visual Studio Menu option to get extension:

enter image description here

Install:

enter image description here

Update 1: Support to compile ".sass" extension

Web compiler does not support old ".sass" format. To compile ".sass", you have to use gulp-sass

Below is the procedure how to setup:

  1. Enable npm (add package.json )

Add package.json

  1. Add gulp file

Add Gulp file

  1. Modify package.json to install gulp-sass
{
  "version": "1.0.0",
  "name": "asp.net",
  "private": true,
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-concat": "^2.6.1",
    "gulp-cssmin": "^0.1.7",
    "gulp-uglify": "^2.1.2",
    "rimraf": "^2.6.1",
    "gulp-sass": "^3.1.0"
  }
}
  1. Add SASS task
var sass = require("gulp-sass");
var paths = {
    webroot: "./wwwroot/" /*Set this to your path accordingly*/
}
paths.scss = paths.webroot + "css/**/*.sass"; /*watches sub folders inside wwwroot/css/ */
gulp.task('sass', function () {
    gulp.src(paths.scss)
        .pipe(sass())
        .pipe(gulp.dest(paths.webroot + "css"));
});
gulp.task('watch-sass', function () {
    gulp.watch(paths.scss, ['sass']);
})
  1. Setup sass-task and run it

sass-task

  1. Add your .sass file inside the watch folder

.sass file

  1. Whenever you modify your .sass file, .css file will be created

output enter image description here

like image 129
Tejasvi Hegde Avatar answered Sep 23 '22 14:09

Tejasvi Hegde