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.

Chapter 8<br />

With the package.json file created, we can install the plugins just by typing<br />

in the following command:<br />

npm install<br />

This is very useful when we share the project with other developers, thus<br />

avoiding the installation of each plugin separately.<br />

Executing the workflow<br />

In order to execute any specific task or even the entire workflow, we just need to type<br />

in the following command:<br />

grunt <br />

In case we just want to clean the last distribution, we may call only the clean<br />

task as follows:<br />

grunt clean<br />

You could also create more than one configuration for each task. For instance, to<br />

configure two environments for the grunt-contrib-connect plugin, you could<br />

perform the following:<br />

connect: {<br />

production: {<br />

options: {<br />

port: 9001,<br />

base: 'dist/'<br />

}<br />

},<br />

development: {<br />

options: {<br />

port: 9002,<br />

base: '/'<br />

}<br />

}<br />

}<br />

Also, you could generate two concatenated files, one with the sources and another<br />

with the libraries, as follows:<br />

concat: {<br />

js: {<br />

src: ["js/**/*.js"],<br />

dest: "dist/js/scripts.js"<br />

[ 155 ]<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!