Search code examples
cssasp.net-mvcsassvisual-studio-express

Can I use Sass(css preprocessor) in Visual Studio Express 2013 for web?


if yes then how because

Mindscape Web Workbench and SassyStudio (free plug-in) Tool not support in vs express free version

and how to compile SCSS to css i already done this

Install-Package SassAndCoffee

enter image description here


Solution

  • i got the solution

    First add this via NuGet console

    Install-Package SassAndCoffee
    

    and in page.cshtml page

    <link href="~/Content/SassDemo.css?@ViewBag.ID" rel="stylesheet" type="text/css" />
    

    viewbag.ID for no need to clear cache of browser every time

    Controller Code

    public ActionResult Index()
            {
                ViewBag.ID = DateTime.Now.ToString("yyyyMMddHHmmss");
                return View();
            }
    

    now run and change variable values for colors u will see effect in css

    SassDemo.scss

    $color: red;
    
       .a{
               width: 100%;
        }
    
        .mainDiv {
            @extend .a; /*Extend/Inheritance  */
            /*width: 100%;*/
            border: 1px solid $color;
            height: 200px;
            padding: 10px;
            margin-top: 10px;
        }
    
        .childDiv {
            height: 55px;
            padding: 5px;
            width: 130px;
            background-color: $color;
            display: inline-block;
        }