Book Image

Learning less.js

Book Image

Learning less.js

Overview of this book

Table of Contents (22 chapters)
Learning Less.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Avoiding code bloat


When designing websites, one of the key aims that should be dear to every designer is to ensure that they avoid code bloat wherever they can so that their finished article works well and is engaging to their audience.

To help with this, there are a number of tips we can use to help reduce code bloat. We've already used some throughout the book so far, but now seems like an opportune moment to revisit and consolidate them into a useful list you can use for future projects:

  • Aim to create a cleaner structure with the use of nesting—this means you can avoid having to reenter duplicate selectors (such as using <ul> within a list or menu) and can keep the code organized as related items are grouped together.

  • Create variables for faster maintenance—these work very much like variables in other programming languages, such as C#. We can set one instance of a variable at the start, then reference this throughout our code; Less will automatically update each instance for you....