Run Gulp.js from eclipse

Overview

This post provides details on how run gulp.js in eclipse.

Pre-requisites:

  • Install node on Local machine.
  • Install node eclipse plugin as described here.
  • Download required node modules to get the required libraries as described here.

Steps to execute Gulp.js:

  • Create gulp.js file with required tasks.
  • Create build.js file with trigger to gulp.js file.
  • Right click on build.js file and run it as Node Application.
  • In order to trigger specific gulp tasks, trigger them via program arguments to build.js.
Find below the snippet of the gulp.js, you can find complete gulp.js here.
var gulp = require('gulp');

:::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::

gulp.task('default', ['build']);

gulp.task('clean', function () {
:::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::
});
   
Find below the snippet of the build.js, you can find complete build.js here.
var gulp = require('gulp');
require('./gulp.js');

if(process.argv[2] == 'clean'){
	gulp.start('clean');
} else if (process.argv[2] == 'output') {
	gulp.start('output');
}else if (process.argv[2] == 'minifiedoutput') {
	gulp.start('minoutput');
} else {
	gulp.start('build');
}
   

Also Read:

Advertisements

Basic NodeEclipse Setup

Overview

Eclipse is an IDE which is built in java and is mostly used for java development. Eclipse also supports multiple other languages through use of plugins.
Eclipse has some of the javascript plugins which aid in javascript development.
In recent years node.js has become one of the major platform for building javascript applications. NodeEclipse is an Eclipse plugin for node.js.

NodeEclipse Installation:

  • Install node js on Local machine.
  • Click Eclipse Help -> Eclipse Market place.
  • Type Node under Find and Click GO.
  • In the displayed list select NodeEclipse and click Update/Install.
  • Select the relevant packages and click Next and finally install.

Configuring NodeEclipse:

On successful installation of Node Eclipse, we need to configure it via Eclipse -> Window -> Preferences

  • Under preferences we see NodeEclipse.
  • On click of NodeEclipse, we have all the configuration details for Node.js running used from eclipse.
  • Revalidate Node.js path and click OK.

Conclusion:

After above setup, Node.js based programming can be used from eclipse itself.