2

Earlier we mentioned that when learning to compress JS, CSS, images and other files, you need to use some related plug-ins. Gulp provides some useful plug-ins to handle HTML and CSS, JavaScript, graphics, and some other content. Let's take a look at some of the different types of plugins in gulp.

HTML and CSS plugins

Plug-indescription
autoprefixerAutomatically include prefixes for CSS properties
gulp-browser-syncUsed to monitor all HTML and CSS files in the CSS directory, and perform real-time reloading of pages in all browsers when the files are changed
gulp-userefUsed to replace references to non-optimized scripts or style sheets
gulp-email-designCreate HTML email template, convert CSS style to inline
gulp-uncssOptimize CSS files and find unused and repeated styles
gulp-cssoIs a CSS optimizer that can minimize CSS files, thereby reducing file size
gulp-htmlminMinimize HTML file
gulp-csscombStyle formatter for making CSS
gulp-csslintIt specifies a CSS linter
gulp-htmlhintSpecify an HTML validator

JavaScript plugin

Plug-indescription
gulp-autopolyfillerIt is the same as autoprefixer, including the necessary polyfill for JavaScript
gulp-jsfmtUsed to search for specific code snippets
gulp-jscsUsed to check JavaScript code style
gulp-modernizrSpecify the HTML, CSS and JavaScript functions provided by the user's browser
gulp-expressStarted the gulp express.js web server
gulp-requirejsUse require.js to combine require.js AMD modules into one file
gulp-platoGenerate complexity analysis report
gulp-complexityAnalyzed the complexity and maintainability of the code
fixmyjsFixed JSHint results
gulp-jscpdUsed as a copy/paste detector for source code
gulp-jsonlintIs a JSON validator
gulp-uglifyJavaScript files minified
gulp-concatLink CSS files

Unit test plugin

Plug-indescription
gulp-nodeunitRun Gulp's node unit test
gulp-jasmineUsed to report issues related to output
gulp-qunitProvide basic console output for QUnit test, and use PhantomJS node module and PhantomJS runner QUnit plug-in
gulp-mochaSpecify the thin packaging around Mocha and run the Mocha test
gulp-karmaDeprecated in Gulp

Graphics plugin

Plug-indescription
gulpiconGenerate sprites from SVG and convert them to PNG
gulp-iconfontUsed with web fonts to create WOFF, EOT, TTF files from SVG
gulp-imacssConvert image files to data URIs and put them in a single CSS file
gulp-responsiveGenerate responsive images for different devices
gulp-sharpIt is used to change and adjust the orientation and background of the image
gulp-svgstoreCombine SVG files and elements into one file
gulp-imagemin&gulp-tinypngUsed to compress PNG, JPEG, GIF, SVG and other images
gulp-spritesmithUsed to create a spritesheet from a set of images and CSS variables

Compiler plugin

Plug-indescription
gulp-lessA few plugins are provided for Gulp
gulp-sassProvide SASS plug-in for Gulp
gulp-compassCompass plug-in for Gulp
gulp-stylusUsed to save the stylus in CSS
gulp-coffeeProvide coffeescript plugin for Gulp
gulp-handlebarsHandle plug-in is provided for Gulp
gulp-jstProvide underline templates in JST
gulp-reactSpecify the Facebook React JSX template as JavaScript
gulp-nunjucksSpecify Nunjucks template in JST
gulp- dustjsDust template specified in JST
gulp-angular-templatecacheSpecify AngularJS template in templateCache

Other plugins

The gulp-clean plugin deletes files and folders, and the gulp-copy plugin copies files from the source file to the new destination.

Plug-indescription
gulp-gruntRun Grunt tasks from Gulp
gulp-watchWhenever a change is made, it will monitor the file
gulp-notifyAs long as the task fails, it will notify the error message
gulp-gitIt allows the use of Git commands.
gulp-jsdocCreate JavaScript documentation for Gulp
gulp-revIt provides static asset revisions to file names
gulp-bumpAdded the version in the JSON package
gulp-bower-filesUsed to inject the pavilion bag
gulp-removelogsThe console.log statement has been removed
gulp-preprocessPreprocess HTML, JavaScript and other files according to context or environment configuration
gulp-connectIt is used for the web server running LiveReload
gulp-shellRun Shell commands
gulp-sshConnect using SSH and SFTP tasks
gulp-zipIt compresses files and folders
gulp-utilProvide utility tools for gulp plugin
gulp-filesizeIt specifies the file size in a human readable format

知否
221 声望177 粉丝

Skrike while the iron is hot.


下一篇 »
Gulp API

引用和评论

0 条评论