Documents

9781782160663_Learning_Less.js_Sample_Chapter

Categories
Published
of 34
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Description
Chapter No.4 Working with Variables, Mixins, and Functions Develop attractive CSS styles efficiently, using the LESS CSS preprocessor
Transcript
    Learning Less.js  Alex Libby Chapter No. 4 Working with Variables, Mixins, and Functions   In this package, you will find: The author’s biography A preview chapter from the book, Chapter no.4 Working with Variables, Mixins, and Functions A synopsis of the book’s content Information on where to buy this book  About the Author Alex Libby  is from an IT support background. He has been involved in supporting end users for the last 18 years in a variety of different environments, and he currently works as a technical analyst, supporting a medium-sized SharePoint estate for an international  parts distributor based in the UK. Although he gets to play with different technologies in his day job, his first true love has always been with the open source movement, and in  particular, experimenting with CSS/CSS3 and HTML5. To date, Alex has written several  books for Packt Publishing, including a video on HTML5 and books on jQuery UI. This is his seventh book with Packt Publishing. I'd like to thank family and friends for their help and encouragement, Arvind for his help and guidance in writing the book, and the reviewers for  providing lots of constructive comments with the reviewing—without them, I am sure I wouldn't have been able to produce this book!  Learning Less.js  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… What This Book Covers Chapter 1, Introducing Less,  takes us through the roles that both HTML and CSS play, and examines the inherent limitations of using CSS as a technology. We begin our  journey by taking a look at the role CSS preprocessors play and how using Less can act as a solution for some of these limiting issues. Chapter 2, Building a Less Development Toolkit,  is where we get to know Less for the first time, with a look at how we can incorporate it in our code, explore its syntax, and create some basic styles. We'll take a look at the different ways of compiling Less into valid CSS and why it is best to precompile code rather than use it dynamically in the browser.  Chapter 3, Getting Started with Less,  delves into the wide range of tools and applications that are available and can be useful for working with Less; the chapter will provide some hints and tips on how to build an effective toolkit for working with Less, which you can integrate into your own development workflow. Chapter 4, Working with Variables, Mixins, and Functions,  continues from where we left off in Chapter 2, Building a Less Development Toolkit, with a look at one of the key concepts of Less, in the form of mixins. We'll take a look at this incredibly powerful tool, which will help you to save a lot of time when developing Less; we will also cover how we can create variables and functions to create our CSS styling when working with Less. Chapter 5, Inheritance, Overriding, and Nesting in Less,  examines how, with a little forethought and careful design, we can use the power of Less to create new styles based on existing ones, but without the need to duplicate the existing code. We'll also see how Less allows us to split style sheets into smaller, more manageable files, where we can group common styles together, making it easier to manage our development. Chapter 6, Migrating Your Site to Less,  contains the answer to the question asked by many developers when starting with Less: how can I incorporate it into existing sites? We'll take a look at some of the tips and tricks that we can use to gradually transition a site to use Less while still maintaining the existing CSS until it has been converted to its Less equivalent. Chapter 7, Manipulating Fonts with Less,  examines how, with some simple tricks, we can easily maintain any font style used within our site with the help of Less; we'll see how, with a little care and planning, we can make minimal changes that will quickly update font styles throughout the whole site. Chapter 8, Media Queries with Less,  takes a look at how we can use Less to quickly and effectively construct responsive sites using the power of media queries. We'll take a brief look at how media queries work and then move on to take a look at how we need to set expectations with clients and decide what should be supported, before using Less to build our queries. Chapter 9, Working with Less in a CMS,  takes us through how Less can be used to great effect when managing styles for any content management system available today. In this chapter, we'll use WordPress as our example to see how Less can first be incorporated directly in code or by using plugins. We'll then move on to the conversion process, with a look at how to transition a WordPress site to use Less, and how we can remove the need to manually compile styles with the use of a Grunt plugin. Chapter 10, Using Bootstrap with Less,  continues our journey through frameworks with a look at the popular Bootstrap system and how it uses Less to create its styles. We'll take a look at its file structure and some of the mixins it uses before configuring it for use on a demo web page as a part of developing a workflow for using Bootstrap with Less.

421 sample

Jul 23, 2017

Adverb List

Jul 23, 2017
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks