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
About the Author
About the Reviewers

String functions

Sass has some built-in functions to manipulate strings. In this recipe, you will learn about the quote() and unquote() functions. These functions add or remove surrounding quotes from a string value.

Getting ready

Read the Installing Sass for command line usage recipe of Chapter 1, Getting Started with Sass, to install Ruby Sass. After this, you can also use Sass interactive to evaluate the results of the string functions, as described in the Using Sass interactive mode and SassScript recipe of Chapter 1, Getting Started with Sass.

How to do it...

The following are the steps for implementing string function:

  1. Create a Sass template called main.scss. This template should contain the SCSS code like the following:

     // scss-lint:disable DuplicateProperty
    .test {
      color: hsla(0, 100%, 50%, 1); //fall-back
      color: unquote('hsla(0, 100%, 50%, 1)');
  2. Compile the SCSS file from the previous step by running the following command in your console:

     sass main.scss
  3. Finally, you will find...