Top Gulp Js frequently asked interview questions
In this post we will look at Gulp Js Interview questions. Examples are provided with explanation.
- What is Gulp Js?
- What are the APIs used in Gulp Js?
- Is gulp based on node.js?
- What is code over configuration?
- How do we install Plugins in Gulp Js?
- What are the HTML & CSS Plugins in Gulp?
- How can Gulp run tasks sequentially?
- What are Unit Tests Plugins?
- How can a node update a specific package?
- How can we uglify output with Browserify in Gulp?
What is Gulp Js?
Gulp Js is used in building JavaScript Task Runner and the toolkit for automating and enhancing complex tasks such as checking, js errors, magnification, compiling SASS, optimizing images, unit testing and CSS files.It is an automation, platform-agnostic and has strong ecosystem.Gulp Js is used in solving problems of code repetitions and is easy to use, is efficient and also has a simple API.
What are the APIs used in Gulp Js?
There are 4 types of APIs used in Gulp Js:gulp.task() used in defining a Task
gulp.src() used in reading Files
gulp.dest() used in writing Files
gulp.watch() used in watching Files for any changes
Is gulp based on node.js?
YES, Gulp is based on node.js.What is code over configuration?
Gulp uses code over configuration that helps in keeping things simple and making complex tasks manageable.Here is an syntax of a grunt file used by gulp:
module.exports = function(grnt) { grnt.initConfig({ pkg: grnt.file.readJSON('package.json'), ConCat: { options: { separator: ';' }, dist: { src: ['src/**/*.js'], dest: 'dist/<%= pkg.name %>.js' } } }); grnt.loadNpmTasks('grnt-contrib-ConCat'); grnt.registerTask('default', ['ConCat']);
How do we install Plugins in Gulp Js?
Plugins are also called minify-css for merging and minifying all the css scripts.It can aslo be installed by using the npm given below:npm install gulp-minify-css --save--dev-gulp