- Learning Less.js
- Alex Libby
- 358字
- 2021-09-03 09:38:10
Summary
We're now ready to start exploring the Less syntax in more detail. Before we do so, let's recap what we learned throughout this chapter.
We began with how you can download and install Less; we first covered how you can download this as a standalone library, before incorporating it into our pages. We also took a brief look at how you can use a CDN link instead of downloading the code; while this isn't recommended for development purposes, it nevertheless is worthwhile for production sites, where the browser can cache the library if a visitor has already accessed the library on a previous site.
Moving on, we then took a look at how you install Less server-side, using the Node platform. We saw how easy it is to compile Less files, using a single command, and that we can perform this as many times as we like, by rerunning the command when needed. We discussed how to install Less by taking a look at the dangers of using it client side and how this should really be limited to use in a development environment only, due to the extra demands placed on the hosting server.
We then changed focus and took a whistle-stop tour on some of the key parts of the Less syntax, as a precursor to exploring it in more detail in later chapters. We covered the use of variables, mixins, nesting, operations, and extending in Less before switching to compiling some basic code to see how the compilation process works. We examined how you can use either a standalone compiler or the command line to perform the same operation. We finished the chapter with a look at how to use the watch()
function within Less—this can be set to watch for any changes in the Less file and force the browser to automatically refresh the page, without the need for manual intervention.
We've now covered the basics of how to install Less and get it up and running in our code. Let's move on and begin our journey through the functionality of Less, starting with a look at mixins, functions, and variables.