Created
August 19, 2016 20:53
-
-
Save jpcercal/50ac659eb65bbe023b851a07e10e8e2d to your computer and use it in GitHub Desktop.
Gruntfile.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(grunt) { | |
| 'use strict'; | |
| grunt.initConfig({ | |
| ngAnnotate: { | |
| options: { | |
| singleQuotes: true | |
| }, | |
| production: { | |
| files: [ | |
| { | |
| expand: true, | |
| cwd: 'src/assets/', | |
| src: ['**/*.js'], | |
| dest: 'src/assets/tmp/' | |
| } | |
| ] | |
| } | |
| }, | |
| concat: { | |
| development: { | |
| src: ['src/assets/js/app.js', 'src/assets/js/**/*.js'], | |
| dest: 'public/js/app.js' | |
| }, | |
| development_vendor_css: { | |
| src: [ | |
| 'bower_components/roboto-condensed/css/roboto-condensed.css', | |
| 'bower_components/bootstrap/dist/css/bootstrap.css', | |
| 'bower_components/font-awesome/css/font-awesome.css' | |
| ], | |
| dest: 'public/css/vendor.css' | |
| }, | |
| development_vendor_js: { | |
| src: [ | |
| 'bower_components/angular/angular.js', | |
| 'bower_components/angular-route/angular-route.js', | |
| 'bower_components/jquery/dist/jquery.js', | |
| 'bower_components/bootstrap/dist/js/bootstrap.js', | |
| 'bower_components/highcharts/highcharts.js' | |
| ], | |
| dest: 'public/js/vendor.js' | |
| }, | |
| production: { | |
| src: ['src/assets/tmp/js/app.js', 'src/assets/tmp/js/**/*.js'], | |
| dest: 'public/js/app.js' | |
| } | |
| }, | |
| uglify: { | |
| production: { | |
| src: ['public/js/app.js'], | |
| dest: 'public/js/app.min.js' | |
| } | |
| }, | |
| sass: { | |
| development: { | |
| files: { | |
| 'public/css/app.css': 'src/assets/scss/index.scss' | |
| } | |
| }, | |
| production: { | |
| options: { | |
| style: 'compressed' | |
| }, | |
| files: { | |
| 'public/css/app.min.css': 'src/assets/scss/index.scss' | |
| } | |
| } | |
| }, | |
| htmlmin: { | |
| production: { | |
| options: { | |
| removeComments: true, | |
| collapseWhitespace: true | |
| }, | |
| files: [{ | |
| src: "public/index.html", | |
| dest: "public/index.html" | |
| }, { | |
| expand: true, | |
| cwd: 'src/view/', | |
| src: ['*.html'], | |
| dest: 'public/view/' | |
| }] | |
| } | |
| }, | |
| jshint: { | |
| files: ['src/assets/**/*.js'], | |
| options: { | |
| globals: { | |
| console: true | |
| } | |
| } | |
| }, | |
| imagemin: { | |
| production: { | |
| files: [{ | |
| expand: true, | |
| cwd: 'src/assets/img/', | |
| src: ['**/*.{png,jpg,gif}'], | |
| dest: 'public/img/' | |
| }] | |
| } | |
| }, | |
| notify_hooks: { | |
| options: { | |
| enabled: true, | |
| max_jshint_notifications: 5, | |
| title: "<PROJECT-NAME>", | |
| success: true, | |
| duration: 2 | |
| } | |
| }, | |
| copy: { | |
| development: { | |
| files: [ | |
| { | |
| src: 'src/favicon.ico', | |
| dest: 'public/favicon.ico' | |
| }, | |
| { | |
| expand: true, | |
| cwd: 'src/assets/img/', | |
| src: ['**/*.{png,jpg,gif}'], | |
| dest: 'public/img/' | |
| }, | |
| { | |
| expand: true, | |
| cwd: 'src/view/', | |
| src: ['*.html'], | |
| dest: 'public/view/' | |
| }, | |
| { | |
| expand: true, | |
| cwd: 'bower_components/font-awesome/fonts/', | |
| src: ['**/*'], | |
| dest: 'public/fonts/' | |
| }, | |
| { | |
| expand: true, | |
| cwd: 'bower_components/roboto-condensed/fonts/', | |
| src: ['**/*'], | |
| dest: 'public/fonts/' | |
| } | |
| ] | |
| }, | |
| production: { | |
| files: [ | |
| { | |
| src: 'favicon.ico', | |
| dest: 'public/' | |
| } | |
| ] | |
| } | |
| }, | |
| processhtml: { | |
| development: { | |
| options: { | |
| process: true, | |
| data: { | |
| stylesheets: [ | |
| 'css/vendor.css', | |
| 'css/app.css' | |
| ], | |
| javascripts: [ | |
| 'js/vendor.js', | |
| 'js/app.js' | |
| ] | |
| } | |
| }, | |
| files: [{ | |
| src: "src/index.html", | |
| dest: "public/index.html" | |
| }] | |
| }, | |
| production: { | |
| options: { | |
| process: true, | |
| data: { | |
| stylesheets: [ | |
| 'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700', | |
| 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css', | |
| 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css', | |
| 'css/app.min.css' | |
| ], | |
| javascripts: [ | |
| 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js', | |
| 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular-route.min.js', | |
| 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js', | |
| 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js', | |
| 'https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.2.6/highcharts.js', | |
| 'js/app.min.js' | |
| ] | |
| } | |
| }, | |
| files: [{ | |
| src: "src/index.html", | |
| dest: "public/index.html" | |
| }] | |
| } | |
| }, | |
| watch: { | |
| dist: { | |
| files: [ | |
| 'src/**/*', | |
| '!src/.sass-cache/' | |
| ], | |
| tasks: ['development'], | |
| options: { | |
| livereload: true, | |
| } | |
| } | |
| }, | |
| clean: { | |
| default: ['src/assets/tmp/**'], | |
| public: ['public/'], | |
| production: ['public/js/app.js'], | |
| } | |
| }); | |
| grunt.loadNpmTasks('grunt-ng-annotate'); | |
| grunt.loadNpmTasks('grunt-contrib-concat'); | |
| grunt.loadNpmTasks('grunt-contrib-uglify'); | |
| grunt.loadNpmTasks('grunt-contrib-sass'); | |
| grunt.loadNpmTasks('grunt-contrib-watch'); | |
| grunt.loadNpmTasks('grunt-contrib-clean'); | |
| grunt.loadNpmTasks('grunt-contrib-htmlmin'); | |
| grunt.loadNpmTasks('grunt-contrib-jshint'); | |
| grunt.loadNpmTasks('grunt-contrib-imagemin'); | |
| grunt.loadNpmTasks('grunt-notify'); | |
| grunt.loadNpmTasks('grunt-contrib-copy'); | |
| grunt.loadNpmTasks('grunt-processhtml'); | |
| grunt.registerTask('default', [ | |
| 'clean:public', | |
| 'concat:development', | |
| 'concat:development_vendor_css', | |
| 'concat:development_vendor_js', | |
| 'jshint', | |
| 'sass:development', | |
| 'copy:development', | |
| 'processhtml:development', | |
| 'clean:default', | |
| 'notify_hooks' | |
| ]); | |
| grunt.registerTask('development', ['default']); | |
| grunt.registerTask('production', [ | |
| 'clean:public', | |
| 'ngAnnotate', | |
| 'concat:production', | |
| 'uglify:production', | |
| 'jshint', | |
| 'sass:production', | |
| 'imagemin', | |
| 'copy:production', | |
| 'processhtml::production', | |
| 'htmlmin', | |
| 'clean:default', | |
| 'clean:production', | |
| 'notify_hooks' | |
| ]); | |
| grunt.registerTask('w', ['watch']); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment