Gulp Basics
In our project we are doing many manual tasks such as copying file, concatenating file, minifying source files.
During project development, few hours get wasted just to copy,minify, concat and build related tasks. These tasks are generally non productive in nature which does not add any productivity in the project. Such build tasks can be automated using gulp.
Build System
Build System is a process to automate the repetitive work by using set of tasks. Set of tasks are collectively called as Task runner.
We will take a glance at some of the examples of tasks and we will classify those into different categories -
Task | Category of the Task |
---|---|
Coding a module | Development Task |
Writing CSS Style | Development Task |
Writing JS Function | Development Task |
Writing Preprocessor using SCSS | Development Task |
Compiling preprocessor for CSS | Build Task |
Concatenating style sheets | Build Task |
Minifying CSS styles | Build Task |
Minifying HTML/JS files | Build Task |
Concatenating script files | Build Task |
Reducing size of images | Build Task |
Reloading server | Build Task |
Creating production or deployment build to store at particular location | Build Task |
Components of Build System
Build system works with 3 components −
- Package managers
- Preprocessors
- Task runners and build tools
Package Managers
It is used to -
- Automate the installation process
- Automate the installation upgrade
- Automate the installation of required depedencies
- Clean libraries
Some of the examples of package managers are bower and npm.
Preprocessors
Using preprocessor we can define and write code in optimized and efficient way which upon compilation converted into native language. i.e Conside below example of Jade i.e HTML Preprocessor -
Few examples of popular preprocessors are −
Native Language | Preprocessor |
---|---|
HTML | Markdown, HAML, Slim, Jade |
CSS | SASS, LESS and Stylus |
JS | CoffeeScript, LiveScript, TypeScript |
Task Runners
We have already studied the task runner which is used to automate tasks such as SASS/LESS to CSS conversion, minify source files and optimize images
Native Language | Task Runners |
---|---|
Java | ANT, Buildr |
JS, UI & Front End | Grunt, Gulp |
Leave a comment