Before starting the exact installation process, let us first understand what are preprocessors and how ‘less’ is useful in development.
With this hope that we all know CSS, let us try to understand what do PreProcessor mean?
In computers, we can say pre-processor means a program that takes an input and produces an output that in return can be used as input for another program.
Similarly, Less is a CSS preprocessor which reduces the CSS development time. Less to CSS conversion is one of the important development activity. Gulp provides `gulp-less` plugin for this process.
The easiest way to install Less on the server is by using npm . but npm package manager has a dependency on node.js, so you should install nodejs first.You can refer following link
to know how to install node js, https://nodejs.org/en/
After installing node js we are ready to install less with the help of npm.
Installation
npm install gulp-less
Sample Code
'use strict';
var gulp = require('gulp');
var sass = require('gulp-less');
gulp.task('less', function () {
return gulp.src('./less/**/*.less')
.pipe(less())
.pipe(gulp.dest('./css'));
});
gulp.task('less:watch', function () {
gulp.watch('./less/**/*.less', ['sass']);
});
Comments-
(March 4, 2023 - 2:25 pm)
-
(August 13, 2023 - 11:02 am)
-
(August 15, 2023 - 4:54 am)
IDM
I used to be able to find good information from your blog
articles.
Ronnie Radon
With thanks! Valuable information!
Effie Shimada
I’m quite certain I’ll learn lots of new stuff right