Book Image

Sass and Compass Designer's Cookbook

By : Bass Jobsen, Stuart Robson
Book Image

Sass and Compass Designer's Cookbook

By: Bass Jobsen, Stuart Robson

Overview of this book

Sass and Compass Designer's Cookbook helps you to get most out of CSS3 and harness its benefits to create engaging and receptive applications. This book will help you develop faster and reduce the maintenance time for your web development projects by using Sass and Compass. You will learn how to use with CSS frameworks such as Bootstrap and Foundation and understand how to use other libraries of pre-built mixins. You will also learn setting up a development environment with Gulp. This book guides you through all the concepts and gives you practical examples for full understanding.
Table of Contents (23 chapters)
Sass and Compass Designer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the @debug, @warn, and @error directives


In this recipe, you will learn how to use the @debug, @warn, and @error directives to debug your code or validate the input for mixins and functions.

Getting ready

This recipe requires the command-line Ruby Sass compiler installed. In the Installing Sass for command-line usage recipe of Chapter 1, Getting Started with Sass, you can read about how to install Ruby and Ruby Sass. You can edit the Sass templates with your favorite text editor.

How to do it...

Use the following steps to learn how to use the @debug, @warn, and @error directives to debug your Sass code:

  1. Create a Sass file test.scss that contains the following SCSS code:

    @mixin set-width($width) {
    
      @if $width < 50 {
        @error "width should be >= 50";
        $width: 1px * $width;
      }
    
      @if unit($width) not 'px' {
        @warn "width (#{$width}) converted to pixels";
        $width: 1px * $width;
      }
    
      $width: $width * 10;
      @debug "width: #{$width}";
      width: $width;
    }
    
    div {
      @include set...