Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- module.exports = function(grunt) {
- //time how long the tasks take.
- require('time-grunt')(grunt);
- //automatically load required grunt tasks
- require('jit-grunt')(grunt, {useminPrepare: 'grunt-usemin'
- });
- // Define the configuration for all the tasks
- grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'),
- //Make sure code styles are up to par and there are no obvious mistakes
- jshint: {
- options: {
- jshintrc: '.jshintrc',
- reporter: require('jshint-stylish')
- },
- all: {
- src: [
- 'Gruntfile.js',
- 'app/scripts/{,*/}*.js'
- ]
- }
- }
- copy: {
- dist: {
- cwd: 'app',
- src: ['**', '!styles/**/*.css', '!scripts/**/*.js'],
- dest: 'dist',
- expand: 'true'
- },
- fonts: {
- files: [{
- //for bootstrap fonts
- expand: true,
- dot: true,
- cwd: 'bower_components/bootstrap/dist',
- src: ['fonts/*,*'],
- dest: 'dist'
- }]
- }
- },
- clean: {
- build: {
- src: ['dist/']
- }
- },
- useminPrepare: {
- html: 'app/menu.html'
- options: {
- dest: 'dist'
- }
- },
- //Concat
- concat: {
- options: {
- separator: ';'
- },
- //dist configuration given by useminPrepare
- dist: {}
- },
- //Uglify
- Uglify: {
- //dist configuration given by useminPrepare
- dist: {}
- },
- cssmin: {
- dist: {}
- },
- //Filerev
- filerev: {
- options: {
- encoding: 'utf8',
- algorithm: 'md5',
- length: 20
- },
- release: {
- //Filerev: release hashes(md5) all assets (images, js, and css)
- // in dist direcftory
- // brackets are used to specify file
- files: [{
- src: [
- 'dist/scripts/*.js',
- 'dist/styles/*.css',
- ]
- }]
- }
- },
- //useminPrepare``
- //Replace all assets with their recent version in html and css files.
- //options.assetDirs holds the directories for finding the assets
- usemin: {
- html: ['dist/*.html'],
- css: ['dist/styles/*.css'],
- options: {
- assetDirs: ['dist', 'dist/styles']
- }
- }
- });
- grunt.registerTask('build', [
- 'clean',
- 'jshint',
- 'useminPrepare',
- 'concat',
- 'cssmin',
- 'uglify',
- 'copy',
- 'filerev',
- 'usemin'
- ]);
- grunt.registerTask('default', ['build']);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement