task runners : simplfiy the pre-proccesses of deployment: gruntgulp.
grunt: - npm i grunt - touch Gruntfile.js - npm i grunt-contrib-lesstime-gruntjit-grunt - npm i grunt-contrib-watchgrunt-browser-sync - simple grunt file for watching and compieling .less files:
module.exports=function(grunt){// Time how long tasks take. Can help when optimizing build timesrequire("time-grunt")(grunt);// Automatically load required Grunt tasksrequire("jit-grunt")(grunt);// Define the configuration for all the tasksgrunt.initConfig({less:{css:{files:{"css/styles.css":"css/styles.less",},},},watch:{files:"css/*.less",tasks:["less"],},browserSync:{dev:{bsFiles:{src:["css/*.css","*.html","js/*.js"],},options:{watchTask:true,server:{baseDir:"./",},},},},});grunt.registerTask("css",["less"]);grunt.registerTask("default",["browserSync","watch"]);};
Grunt:
at the cmd: grunt less => All .less files compiling into css.
at the cmd: grunt => watching and compiling automatically
for pre-deploy process we need: - grunt-contrib-copy: copying files to dist folder.
grunt-contrib-clean: clean dist each time before run build