Book Image

Bootstrap 4 Site Blueprints - Second Edition

By : Ian Whitney, David Cochran
Book Image

Bootstrap 4 Site Blueprints - Second Edition

By: Ian Whitney, David Cochran

Overview of this book

Packed with trade secrets, this second edition is your one-stop solution to creating websites that will provide the best experience for your users. We cover six popular, real-world examples, where each project teaches you about the various functionalities of Bootstrap 4 and their implementation. The book starts off by getting you up and running with the new features of Bootstrap 4 before gradually moving on to customizing your blog with Bootstrap and SASS, building a portfolio site, and turning it into a WordPress theme. In the process, you will learn to recompile Bootstrap files using SASS, design a user interface, and integrate JavaScript plugins. Towards the end of the book, you will also be introduced to integrating Bootstrap 4 with popular application frameworks such as Angular 2, Ruby on Rails, and React.
Table of Contents (15 chapters)
Bootstrap 4 Site Blueprints
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface

The power of Sass in your project


Sass is a preprocessor for CSS code and is an extension of CSS3 which adds nested rules, variables, mixins, functions, selector inheritance, and more. In the following section, you can read how Sass extends the CSS syntax and helps you to DRY code your CSS.

Nested rules

Nested rules greatly enhance the efficiency of composing styles. For example, writing selectors in CSS can be highly repetitive:

.navbar-nav { ... } 
.navbar-nav > li { ... } 
.navbar-nav > li > a { ... } 
.navbar-nav > li > a:hover, 
.navbar-nav > li > a:focus { ... } 

This same set of selectors and their styles can be written much more easily in Sass, by means of a simple nesting pattern as shown in the following SCSS code:

.navbar-nav { ... 
  > li { ... 
    > a { ... 
      &:hover, 
      &:focus { ... } 
    } 
  } 
} 

Once compiled, these rules come out as standard CSS. But, the nesting...