Basically i found it is useful to do some tasks such as Build directory structure for your production deployment. To use gulp you need to follow below steps
If you've previously installed gulp globally, run
npm rm --global gulp
before following these instructions- Install gulp-cli globally
npm install -globally gulp-cli - Once you install gulp-cli. You can add for development by running following command. this command install the gulp and adds entry in package.json.
- npm install --save-dev gulp
- Simillarly you can install gulp-util and so-on. e.g.
npm install --save-dev gulp-util - Create gulpfile.js in your project root ditrectory.
e.g. code
/* File: gulpfile.js */
// grab our gulp packagesvar gulp = require('gulp'),
gutil = require('gulp-util');
// create a default task and just log a message
gulp.task('default', function() {
return gutil.log('Gulp is running!')
}); - open command prompt of your project root folder and type "gulp". you will get following result. Basically the "gulp" command look into your current folder for gulpfile.js file and run it.
C:\>gulp
[14:00:06] Using gulpfile C:\..\..\gulpfile.js
[14:00:06] Starting 'default'...
[14:00:06] Gulp is running!
[14:00:06] Finished 'default' after 11 ms
Some times you may get the following error when you try to run the "gulp" command even after proper installation.
'gulp' is not recognized as an internal or external commandSolution: Type following command in the Command Prompt
PATH=%PATH%;C:\Users\username\AppData\Roaming\npm
No comments:
Post a Comment