Posts

Showing posts from June, 2017

Gulp : Alternative of Grunt

Image
What is Gulp? Gulp is a workflow automation tool. Like grunt, it works using npm and the package.json file. All available plugins will also be downloaded using npm and added as devDependencies in the package.json file.  One of the main differences with Gulp is that it uses streams. A stream is a set of functions through which a file will go and be modified in memory. The file will be written on the disk only at the end of the process so it is more efficient. Grunt tasks, on the other hand, work as silos and cannot be chained. In short, Gulp is not a task runner, but a "build system helper". How can I use it? It uses a command-line interface (CLI) to run custom tasks defined in a file (known as a gulptfile ). It is distributed via npm. Step 1. Create the package.json file Use npm to init the file: npm init Then you will see some questions [2]. After giving those answers you will see the format of  package.json  [3]. Type " yes " to confirm it...

Grunt : The Task Runner

Image
What is Grunt? Grunt is a JavaScript task runner , a tool used to automatically perform frequently used tasks such as minification, compilation, unit testing, linting, etc. The basic principle for Grunt is to give us an easy way to run tasks . A task is a set of code files and configuration files already created for you. You can get new tasks by installing Grunt plugins that you will get using npm. How can I use it? It uses a command-line interface (CLI) to run custom tasks defined in a file (known as a Gruntfile). Grunt is written in Node.js. It is distributed via npm. Step 1. Create the package.json file Use npm to init the file: npm init Then you will see some questions [2]. After giving those answers you will see the format of package.json [3]. Type " yes " to confirm it [4]. Step 2. Install Grunt globally and locally At first install Grunt globally. npm install -g grunt Then install it locally. npm install grunt --save-dev Note: Do n...