- Learning Less.js
- Alex Libby
- 280字
- 2021-09-03 09:38:02
Preface
Imagine the scene if you will—it's 5 pm, late in the day, and your client wants the impossible…
You know the scene—you've created a kick-ass website, but the client isn't happy with the color of the buttons you've used on the site. They say the color shades used aren't quite there and need tweaking. A reasonable request, right? Except that there are dozens of buttons throughout the site, with most of them using different colors…Oh heck… no chance of an early finish then…
Or, is there? There is—what if we could change a handful of values and it automatically changes each button for you? Sounds crazy, right?
Wrong, it is absolutely possible. Welcome to the world of CSS preprocessors and Less! The power of Less means that we can set a couple of values that can be applied to any number of elements (such as buttons). Rather than having to change all of the buttons manually, we change the values and hit a button to recompile our code. Voilà! The code is instantly updated, and the buttons show the new color.
Throughout this book, we'll meet the Less library, learn how to use it, and apply its power to a number of real-world scenarios, such as updating buttons to build a complete theme for CMS systems, such as WordPress. We'll take a look at the subjects such as animating, color management, abstracting frameworks, and creating media queries for responsive sites.
It's going to be a great journey, full of twists and turns—the question is, are you ready? If so, let's make a start…