Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Learning less.js
Learning less.js

Learning less.js: Develop attractive CSS styles efficiently, using the Less CSS preprocessor

eBook
$26.09 $28.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Learning less.js

Chapter 2. Building a Less Development Toolkit

We've covered the principles behind Less, and saw how it can help reduce the effort required to manage style sheets with the use of variables, functions, and mixins. We're almost ready to start coding, but before we can do so, there's one small thing missing—we need some tools!

You might wonder whether there is a need for more tools, given that CSS is just plain text and that we don't need anything to edit plain text files, right? Well, plain text editors will work, but as we'll see in this chapter, there are tools available that include support for Less in order to help make editing files easier.

Throughout this chapter, we will look at a selection of tools that you may find useful for working with Less; we will install a selection that will be used for the purposes of the exercises throughout this book, although you can always pick and choose the packages you prefer to use.

In this chapter, we will cover...

Choosing an IDE or editor

We need to start somewhere, and what better place than an editor. After all, we can't produce anything if we don't have something that we can use to write it! Editing Less files is very easy—they are plain text files, which can be edited in almost any editor.

The downside is that there are dozens of editors available, either free or at a cost. However, there are some editors that have support for Less either included by default or available as an add-on package, which includes the following:

Compiling Less files with a standalone compiler

Once we've produced a valid Less file, we need to compile it into its CSS equivalent. For this, we have two options: the first is to compile from the command line; we will examine this in more detail later in this chapter, in the Compiling from the command line section. The second is using a standalone compiler, for which we can use one of the following compilers available for this purpose:

Each of these compilers performs the same basic function of compiling Less files, but in different ways. I would suggest that you try each one out and stick with the one that you find preferable.

We must start somewhere, so first, let's take a look at WinLess.

WinLess

WinLess is a Windows-based open source GUI frontend for less.js, which can be downloaded from http://winless.org/downloads/WinLess-1.8.2.msi. This...

Compiling from the command line

Some of you might prefer not to have to use a standalone application to compile Less code task; after all, who needs to learn yet another application in order to perform a task that can easily be automated and run in the background, right?

Absolutely; instead of using a standalone compiler, we can use the command line to perform the same operation using the JavaScript-based platform, which is Node.js, available at http://www.nodejs.org. Versions of this application are available for the Windows, Linux, Mac, and even SunOS platforms. Otherwise, you can always try compiling from the source if you are feeling adventurous! Let's take a look at how we can use this in more detail.

To download and install Node.js, perform the following steps:

  1. Browse http://www.nodejs.org, and click on Download from the main page; this should automatically determine the right version for your platform. At the time of writing this, the latest version for Windows is node-v0.10.24...

Debugging Less in browsers

A key part of developing code of any description is the fixing of any errors or bugs; working with Less code is no exception. We can, of course, do this manually or use a linting tool such as CSS Lint (http://www.csslint.net), but either is likely to require working directly with the compiled CSS code, which will make it harder to trace a fault back to your existing Less code.

Fortunately, we have a couple of options that will help in this respect—we can either debug directly in Firefox using the FireLESS plugin, or we can set up a source map that will translate a compiled style back to the line number in the original Less file. Let's take a look at installing FireLESS first and get ready for when we start developing code in the next chapter.

Debugging the Less code using Firefox

To enable support for debugging Less in Firefox, we first need to ensure that Firebug is installed; for this, you can download it from https://addons.mozilla.org/en-US/firefox...

Other useful tools

We've almost come to the end of this chapter, but before we move onto starting to develop the Less code, we should take a look at a few tools that you might find useful once you've spent some time developing CSS with Less:

  • Adobe Kuler: You can find this tool at https://kuler.adobe.com/. Although this is not immediately associated with Less, you might find this useful when choosing a color scheme for your site. Kuler has some useful tools that help you choose a suitable color palette from which we can take and use the color values within our Less styles.
  • Live.js: If you spend any amount of time editing styles, you will have to manually refresh the pages after each change; this can get tedious if you are making lots of changes! Fortunately, we can get around this with the use of the Live.js script. This tool is developed by Martin Kool and is available at http://www.livejs.com. It automatically forces a refresh to the page being worked on so that we can see changes...

Summary

Working with Less can be very rewarding when you have the right tools installed and available for use in your workflow. We started with a look at some of the editors that are available; these include support for Less, such as Sublime Text or Notepad++. We then moved on to installing Sublime Text 2 and added support for Less.

Next up came a discussion on the options available for compiling Less code—the first option covered how you can use a standalone compiler such as WinLess to produce the final CSS code; we took a look at each of the main compilers available, and followed it by installing Crunch!.

We then moved on to examining how you can use the command line to compile the code—we looked at how using a standalone compiler meant adding another layer into your development workflow, which isn't ideal. We ran through a basic installation of Node.js, which we then first configured to compile Less files before adding an automatic watch facility and finishing with a...

Left arrow icon Right arrow icon

Description

If you are a designer or developer who wants to quickly learn how to harness the power of Less.js to write more efficient CSS styles that can be applied to a website of any size, then this book is for you. This book will help you master both the basic functions and advanced features of Less.js. It would be helpful to have some familiarity of writing CSS styles, although no prior experience of using CSS preprocessors is required.

What you will learn

  • Explore the different features of the Less library
  • Build an effective toolkit that helps in your development workflow, using different tools in Less
  • Streamline the effort required when constructing themes for content management systems, such as WordPress, using Less
  • Discover how you can use Less to make frameworks work for you in an effective way
  • Enhance the use of Less when working with color, one of the key elements of website design
  • Work with Less to reduce the effort required to construct responsive websites
  • Add flair to your website or online application with animation effects using Less
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 24, 2014
Length: 342 pages
Edition : 1st
Language : English
ISBN-13 : 9781782160663
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Oct 24, 2014
Length: 342 pages
Edition : 1st
Language : English
ISBN-13 : 9781782160663
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 152.97
Learning less.js
$48.99
Learning Bootstrap
$48.99
LESS WEB DEVELOPMENT COOKBOOK
$54.99
Total $ 152.97 Stars icon

Table of Contents

16 Chapters
1. Introducing Less Chevron down icon Chevron up icon
2. Building a Less Development Toolkit Chevron down icon Chevron up icon
3. Getting Started with Less Chevron down icon Chevron up icon
4. Working with Variables, Mixins, and Functions Chevron down icon Chevron up icon
5. Inheritance, Overriding, and Nesting in Less Chevron down icon Chevron up icon
6. Migrating Your Site to Less Chevron down icon Chevron up icon
7. Manipulating Fonts with Less Chevron down icon Chevron up icon
8. Media Queries with Less Chevron down icon Chevron up icon
9. Working with Less in a CMS Chevron down icon Chevron up icon
10. Using Bootstrap with Less Chevron down icon Chevron up icon
11. Abstracting CSS Frameworks with Less Chevron down icon Chevron up icon
12. Color Processing with Less Chevron down icon Chevron up icon
13. Animation with Less Chevron down icon Chevron up icon
14. Extending and Contributing to Less Chevron down icon Chevron up icon
A. Color Functions in Less Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(2 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
M. Quick Apr 10, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have been a server-side developer for most of career. About 6 months ago I inherited a project that used LESS. I do have a strong CSS background but I was prepared for LESS. I picked up the "Learning Less.Js" from Packt Publishing and was again impressed with another Packt Publishing book.The book was laid out perfectly for someone who needed to get pick things up quick but didn't need the specifics of CSS. The biggest thing for me is that the author relayed LESS ideas with concepts that OO developers use on a daily basis. The wording and explanations of mixins, variables and functions were easy to understand and definitely helped me understand existing LESS files.Examples build on previous examples with small changes as you read through the chapter. Examples are never complicated and, unlike most books, you may not need to download the samples as the examples are tight and concise.I would strongly recommend this book for server-side developers who need to jump into the UI and want a good jumping point.
Amazon Verified review Amazon
Markus Lutz Feb 28, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book „Learning Less.js“ is a good choice for beginners. In the first chapter you can read why Less is a good choice. It discusses the advantages of less by means of practical examples. Tools for development with Less are introduced.The third Chapter starts with the practice. You learn development with node and bower. The examples in the book are very practical. It shows all the necessary features e.g. mixing, media queries, responsive and more. You learn to work with less in Wordpress and using grunt in wordpress development. A chapter is devoted for using bootstrap with less and an another chapter deals with color processing.A highly recommended book for anyone who wants to learn Less.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon