Skip navigation

Tag Archives: sass

Home Sweet Home

Home Sweet Home

I guess Sass happened a few years ago and I missed the memo. That’s bad news for me because since I didn’t hug it, and pet it, and squeeze it with such love as soon as it appeared, I missed the total-newb tutorial train. Everyone’s already supposed to know everything about it by now, so all the advanced Sass techniques and integrations assume you do. After all, how could you not? …unless you’ve been living under a rock. Which I have.

I get what Sass does and I know Foundation makes heavy use of it for customization. When I realized I wanted Foundation to render rows wider than 1000 pixels by default, I knew it was time to adopt Sass. I simply had no idea how to do it for my current setup, which is Visual Studio 2013 Update 3, Web Essentials 2013 for Update 3, and Foundation 5.

In my travels, I kept seeing mention of something called Compass (I have no idea what it is or why I would need it), but according to what I’ve been reading, Web Essentials recently supplanted much of that tool’s usefulness in Visual Studio. Fine with me: the less bloat, the better. Unfortunately, the web development community at large hasn’t really caught up with this turn of events, so tutorials for Compass are still all over the place like it’s the only option for this particular quest. And it’s not.

Without further ado, I will describe here the steps I followed in order to customize Foundation 5 via Sass in a new ASP.NET MVC 5 Web Application through Visual Studio 2013 Update 3 with Web Essentials 2013 for Update 3 installed.

  1. In Visual Studio, FILE → New → Project… → Installed → Templates → Visual C# → Web → ASP.NET Web Application → (name it whatever) → OK.
  2. MVC → OK.
  3. Right-click your new Web Application project in the Solution Explorer and select Manage NuGet Packages…
  4. Search for “foundation sass”. At the time of this writing, the most appropriate package was Zurb Foundation 5 (for Sites) Core Sass files. I guess you could alternatively do this in the Package Manager Console:
  5. Rename  /Content/Site.css to  /Content/Site.scss (CSS to SCSS) and replace its contents with the following, which puts a custom variable out there and then processes it against the core Foundation SCSS files to create a compiled CSS file:

    Let me briefly explain what’s going on here…

    • Line 4: If you don’t have this line, you can’t do stuff like rem-calc() in your customizations… which, as it turns out, is exactly what I need to widen the rows. This crucial little tidbit stole an hour of my life. It’s mentioned in the documentation, but it should just be there by default. I’ll explain the pathing in a sec.
    • Line 6: That’s me doing what I came here to do: I want Foundation to take advantage of wider screens. Instead of limiting itself to 1000 pixels, I want 1200 pixels. Much better. Also, super secret unobvious magic: order matters!
    • Lines 8-10: These three files are what actually build the Foundation CSS. Similar to what happened on line 4, we have to point Web Essentials to the files using paths. You’ll notice that the /sass/foundation/Site.scss file (which we didn’t use in this scenario) doesn’t have pathing because all those files are in the same directory. It’s also missing the ever-important line 4, which is just cruel if you’re trying to use it as an example. Ahem.
  6. Saving Site.scss generates Site.css.

    Saving Site.scss generates Site.css.

    As soon as you save your modified Site.scss, Web Essentials will compile Site.css and stick it under Site.scss.

  7. Run your project now and you’ll see that Foundation has been applied to the default ASP.NET hello world page. It’s not the best test in the world, but it’s quick and it shows it’s working. Change 1200 to 700 or something and refresh to see the effects.


The $row-width setting I modified is just one of the many things you can customize. Check /sass/foundation/_settings.scss for more options. The official Foundation documentation explains a few of them on a per-feature basis, too.

It’s not that this is terribly difficult… I just couldn’t find it explained the way I needed given my varying levels of proficiency with these tools. Hope this helps someone save a few hours and tears.