gulp common plug-ins of the gulp-load-plugins use

More gulp common plug-ins use please visit: gulp common plug-ins summary


gulp-load-plugins This is a batch tool to introduce dependency package.json file.

Greater use of the document, please click visit gulp-load-plugins tool official website .

installation

npm install --save-dev gulp-load-plugins

use

Given a package.jsonfile, the file has the following dependencies:

{
     “依赖”:{
         “ gulp-jshint ”:“ * ”,
         “ gulp -concat ”:“ * ”
    }
}

Add this to your Gulpfile.js:

const gulp = require('gulp');
const gulpLoadPlugins = require('gulp-load-plugins');
const plugins = gulpLoadPlugins();

Or even shorter:

const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();

It will lead to the occurrence of the following conditions (broadly speaking, is the delay in loading plug-ins, but in practice you will not notice any difference):

plugins.jshint = require('gulp-jshint');
plugins.concat = require('gulp-concat');

You can then use them as these plug-ins like the manual, but they are referred to plugins.name (), rather than just name ().

This saves you from having to manually requires that each gulp plug.

Guess you like

Origin www.cnblogs.com/jiaoshou/p/12032882.html