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.

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

});<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.registerTask("dist", ["clean", "jshint", "concat",<br />

"uglify", "copy"]);<br />

}<br />

[ 151 ]<br />

Chapter 8<br />

6. Testing step: Grunt has a plugin called grunt-karma that works with Karma<br />

by reading its karma.conf.js file and running the tests. It can be installed<br />

with the following command:<br />

npm install grunt-karma --save-dev<br />

After this, we just need to configure the location of Karma's configuration<br />

file, as well as load the plugin and include the task in our workflow,<br />

as follows:<br />

Gruntfile.js<br />

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

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!