Book Image

LESS WEB DEVELOPMENT COOKBOOK

Book Image

LESS WEB DEVELOPMENT COOKBOOK

Overview of this book

Table of Contents (19 chapters)
Less Web Development Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


Less extends CSS with variables and mixins, which helps you to write reusable code. The recipes in this chapter show you how to use variables and mixins. You will see and learn that meeting the DRY principle of software programming can be accomplished with Less. Variables allow you to set and edit the commonly used values only once, and mixins can be reused to set the properties of more than one CSS style.

In this chapter, you will learn how to use and declare variables in Less. Less uses lazy loading for variables, which means they do not have to be declared before being used. Less also uses the last declaration wins rule when declaring the same variable more than once in your code. The last declaration wins rule means that the last assigned value will be used at the point of initialization. Both features make it easy to override a variable at the end of your code. In this way, the customization of your code becomes easy. You will also learn how to escape values when assigning...