GruntJS in Simple English Part4

How we use grunt in Javascript?

We used many ways for grunt in Javascript some of the main features are below.

  1. Validating Javascript using – jshint
  2. Compressing Javascript using – Uglify
  3. Cleaning folders and files using – Contrib-Clean (We Checked already in previous part)

We are going to compiling typescript files to Javascript.

The Steps are below :-

  • Install the plug-in using package control npm install grunt-typescript -save-devTHere are many packages are there this one is popular and good one so we choose this package
  • –save -dev option those packages saved in local only not globally
  • compile one (TYpescript) to one (Javascript)
  • compile many (Typescript Files) to one (Javascript)
  • After installing this package means the package.json file over write like below

  • Create the Gruntfile.js
  • I have created the Gruntfile.js please refer below file

  • Run as grunt default
  • The compiled javascript files are in outputJsFiles folder