16.07.2017 Views

AngularJS Essentials

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Automating the Workflow<br />

}<br />

});<br />

dist: {<br />

options: {<br />

port: 9001,<br />

base: 'dist/'<br />

}<br />

}<br />

grunt.loadNpmTasks("grunt-contrib-clean");<br />

grunt.loadNpmTasks("grunt-contrib-jshint");<br />

grunt.loadNpmTasks("grunt-contrib-concat");<br />

grunt.loadNpmTasks("grunt-contrib-uglify");<br />

grunt.loadNpmTasks("grunt-contrib-copy");<br />

grunt.loadNpmTasks("grunt-karma");<br />

grunt.loadNpmTasks("grunt-contrib-connect");<br />

grunt.registerTask("dist", ["clean", "jshint", "concat",<br />

"uglify", "copy", "karma", "connect:dist:keepalive"])<br />

}<br />

Note that we need to use the keepalive option with the connect task inside<br />

our workflow definition. This is important because, by default, the server will<br />

run only as long as Grunt is running. In the following code, the package.<br />

jsonfile file is installed after the installation of the plugins:<br />

package.json<br />

{<br />

}<br />

"name": "parking",<br />

"version": "0.1.0",<br />

"devDependencies": {<br />

"grunt": "~0.4.5",<br />

"grunt-contrib-clean": "~0.5.0",<br />

"grunt-contrib-jshint": "~0.10.0",<br />

"grunt-contrib-concat": "~0.4.0",<br />

"grunt-contrib-uglify": "~0.5.0",<br />

"grunt-contrib-copy": "~0.5.0",<br />

"grunt-karma": "~0.8.3",<br />

"karma": "~0.12.16",<br />

"grunt-contrib-connect": "~0.8.0"<br />

}<br />

[ 154 ]<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!