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 />

7. Running step: The last and optional step is about running the application<br />

after the distribution package is built. Grunt has a web server plugin called<br />

grunt-connect, and we just need to type in the following command to<br />

install it:<br />

npm install grunt-contrib-connect --save-dev<br />

After this, we need to configure at least the base directory of the distribution<br />

package and also the port in which the server will run:<br />

Gruntfile.js<br />

module.exports = function (grunt) {<br />

grunt.initConfig({<br />

clean: {<br />

dist: ["dist/"]<br />

},<br />

jshint: {<br />

dist: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js']<br />

},<br />

concat: {<br />

dist: {<br />

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

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

}<br />

},<br />

uglify: {<br />

dist: {<br />

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

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

}<br />

},<br />

copy: {<br />

dist: {<br />

src: ["index.html", "lib/*", "partials/*", "css/*"],<br />

dest: "dist/"<br />

}<br />

},<br />

karma: {<br />

dist: {<br />

configFile: "karma.conf.js"<br />

}<br />

},<br />

connect: {<br />

[ 153 ]<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!