github.com/ghodss/etcd@v0.3.1-0.20140417172404-cc329bfa55cb/mod/dashboard/Gruntfile.js (about)

     1  // Generated on 2013-10-07 using generator-webapp 0.4.3
     2  'use strict';
     3  
     4  // # Globbing
     5  // for performance reasons we're only matching one level down:
     6  // 'test/spec/{,*/}*.js'
     7  // use this if you want to recursively match all subfolders:
     8  // 'test/spec/**/*.js'
     9  
    10  module.exports = function (grunt) {
    11      // show elapsed time at the end
    12      require('time-grunt')(grunt);
    13      // load all grunt tasks
    14      require('load-grunt-tasks')(grunt);
    15  
    16      grunt.initConfig({
    17          // configurable paths
    18          uglify: {
    19            options: {
    20              mangle: false
    21            },
    22          },
    23          yeoman: {
    24              app: 'app',
    25              dist: 'dist'
    26          },
    27          watch: {
    28              compass: {
    29                  files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
    30                  tasks: ['compass:server', 'autoprefixer']
    31              },
    32              styles: {
    33                  files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
    34                  tasks: ['copy:styles', 'autoprefixer']
    35              },
    36              livereload: {
    37                  options: {
    38                      livereload: '<%= connect.options.livereload %>'
    39                  },
    40                  files: [
    41                      '<%= yeoman.app %>/*.html',
    42                      '.tmp/styles/{,*/}*.css',
    43                      '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
    44                      '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
    45                  ]
    46              }
    47          },
    48          connect: {
    49              options: {
    50                  port: 9000,
    51                  livereload: 35729,
    52                  // change this to '0.0.0.0' to access the server from outside
    53                  hostname: 'localhost'
    54              },
    55              livereload: {
    56                  options: {
    57                      open: true,
    58                      base: [
    59                          '.tmp',
    60                          '<%= yeoman.app %>'
    61                      ]
    62                  }
    63              },
    64              test: {
    65                  options: {
    66                      base: [
    67                          '.tmp',
    68                          'test',
    69                          '<%= yeoman.app %>'
    70                      ]
    71                  }
    72              },
    73              dist: {
    74                  options: {
    75                      open: true,
    76                      base: '<%= yeoman.dist %>'
    77                  }
    78              }
    79          },
    80          clean: {
    81              dist: {
    82                  files: [{
    83                      dot: true,
    84                      src: [
    85                          '.tmp',
    86                          '<%= yeoman.dist %>/*',
    87                          '!<%= yeoman.dist %>/.git*'
    88                      ]
    89                  }]
    90              },
    91              server: '.tmp'
    92          },
    93          jshint: {
    94              options: {
    95                  jshintrc: '.jshintrc'
    96              },
    97              all: [
    98                  '<%= yeoman.app %>/scripts/{,*/}*.js',
    99                  '!<%= yeoman.app %>/scripts/vendor/*',
   100              ]
   101          },
   102          mocha: {
   103              all: {
   104                  options: {
   105                      run: true,
   106                      urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
   107                  }
   108              }
   109          },
   110          compass: {
   111              options: {
   112                  sassDir: '<%= yeoman.app %>/styles',
   113                  cssDir: '.tmp/styles',
   114                  generatedImagesDir: '.tmp/images/generated',
   115                  imagesDir: '<%= yeoman.app %>/images',
   116                  javascriptsDir: '<%= yeoman.app %>/scripts',
   117                  fontsDir: '<%= yeoman.app %>/styles/fonts',
   118                  importPath: '<%= yeoman.app %>/bower_components',
   119                  httpImagesPath: '/images',
   120                  httpGeneratedImagesPath: '/images/generated',
   121                  httpFontsPath: '/styles/fonts',
   122                  relativeAssets: false,
   123                  assetCacheBuster: false
   124              },
   125              dist: {
   126                  options: {
   127                      generatedImagesDir: '<%= yeoman.dist %>/images/generated'
   128                  }
   129              },
   130              server: {
   131                  options: {
   132                      debugInfo: true
   133                  }
   134              }
   135          },
   136          autoprefixer: {
   137              options: {
   138                  browsers: ['last 1 version']
   139              },
   140              dist: {
   141                  files: [{
   142                      expand: true,
   143                      cwd: '.tmp/styles/',
   144                      src: '{,*/}*.css',
   145                      dest: '.tmp/styles/'
   146                  }]
   147              }
   148          },
   149          // not used since Uglify task does concat,
   150          // but still available if needed
   151          /*concat: {
   152              dist: {}
   153          },*/
   154          requirejs: {
   155              dist: {
   156                  // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
   157                  options: {
   158                      // `name` and `out` is set by grunt-usemin
   159                      baseUrl: '<%= yeoman.app %>/scripts',
   160                      optimize: 'none',
   161                      // TODO: Figure out how to make sourcemaps work with grunt-usemin
   162                      // https://github.com/yeoman/grunt-usemin/issues/30
   163                      //generateSourceMaps: true,
   164                      // required to support SourceMaps
   165                      // http://requirejs.org/docs/errors.html#sourcemapcomments
   166                      preserveLicenseComments: false,
   167                      useStrict: true,
   168                      wrap: true
   169                      //uglify2: {} // https://github.com/mishoo/UglifyJS2
   170                  }
   171              }
   172          },
   173          useminPrepare: {
   174              options: {
   175                  dest: '<%= yeoman.dist %>'
   176              },
   177              html: ['<%= yeoman.app %>/index.html']
   178          },
   179          usemin: {
   180              options: {
   181                  dirs: ['<%= yeoman.dist %>']
   182              },
   183              html: ['<%= yeoman.dist %>/{,*/}*.html'],
   184              css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
   185          },
   186          imagemin: {
   187              dist: {
   188                  files: [{
   189                      expand: true,
   190                      cwd: '<%= yeoman.app %>/images',
   191                      src: '{,*/}*.{png,jpg,jpeg}',
   192                      dest: '<%= yeoman.dist %>/images'
   193                  }]
   194              }
   195          },
   196          svgmin: {
   197              dist: {
   198                  files: [{
   199                      expand: true,
   200                      cwd: '<%= yeoman.app %>/images',
   201                      src: '{,*/}*.svg',
   202                      dest: '<%= yeoman.dist %>/images'
   203                  }]
   204              }
   205          },
   206          cssmin: {
   207              // This task is pre-configured if you do not wish to use Usemin
   208              // blocks for your CSS. By default, the Usemin block from your
   209              // `index.html` will take care of minification, e.g.
   210              //
   211              //     <!-- build:css({.tmp,app}) styles/main.css -->
   212              //
   213              // dist: {
   214              //     files: {
   215              //         '<%= yeoman.dist %>/styles/main.css': [
   216              //             '.tmp/styles/{,*/}*.css',
   217              //             '<%= yeoman.app %>/styles/{,*/}*.css'
   218              //         ]
   219              //     }
   220              // }
   221          },
   222          htmlmin: {
   223              dist: {
   224                  options: {
   225                      /*removeCommentsFromCDATA: true,
   226                      // https://github.com/yeoman/grunt-usemin/issues/44
   227                      //collapseWhitespace: true,
   228                      collapseBooleanAttributes: true,
   229                      removeAttributeQuotes: true,
   230                      removeRedundantAttributes: true,
   231                      useShortDoctype: true,
   232                      removeEmptyAttributes: true,
   233                      removeOptionalTags: true*/
   234                  },
   235                  files: [{
   236                      expand: true,
   237                      cwd: '<%= yeoman.app %>',
   238                      src: '*.html',
   239                      dest: '<%= yeoman.dist %>'
   240                  }]
   241              }
   242          },
   243  
   244          ngmin: {
   245            dist: {
   246              src: '.tmp/concat/scripts/app.js',
   247              dest: '.tmp/concat/scripts/app.js'
   248            }
   249          },
   250  
   251          // Put files not handled in other tasks here
   252          copy: {
   253              dist: {
   254                  files: [{
   255                      expand: true,
   256                      dot: true,
   257                      cwd: '<%= yeoman.app %>',
   258                      dest: '<%= yeoman.dist %>',
   259                      src: [
   260                          '*.{ico,png,txt}',
   261                          '.htaccess',
   262                          'images/{,*/}*.{webp,gif,svg}',
   263                          'styles/fonts/{,*/}*.*',
   264                          'views/*.*',
   265                          //'index.html',
   266                          'bower_components/sass-bootstrap/fonts/*.*'
   267                      ]
   268                  }]
   269              },
   270              styles: {
   271                  expand: true,
   272                  dot: true,
   273                  cwd: '<%= yeoman.app %>/styles',
   274                  dest: '.tmp/styles/',
   275                  src: '{,*/}*.css'
   276              }
   277          },
   278          modernizr: {
   279              devFile: '<%= yeoman.app %>/bower_components/modernizr/modernizr.js',
   280              outputFile: '<%= yeoman.dist %>/bower_components/modernizr/modernizr.js',
   281              files: [
   282                  '<%= yeoman.dist %>/scripts/{,*/}*.js',
   283                  '<%= yeoman.dist %>/styles/{,*/}*.css',
   284                  '!<%= yeoman.dist %>/scripts/vendor/*'
   285              ],
   286              uglify: true
   287          },
   288          concurrent: {
   289              server: [
   290                  'compass',
   291                  'copy:styles'
   292              ],
   293              test: [
   294                  'copy:styles'
   295              ],
   296              dist: [
   297                  //'compass',
   298                  'copy:styles',
   299                  'imagemin',
   300                  'svgmin',
   301                  'htmlmin'
   302              ]
   303          },
   304          bower: {
   305              options: {
   306                  exclude: ['modernizr']
   307              },
   308              all: {
   309                  rjsConfig: '<%= yeoman.app %>/scripts/main.js'
   310              }
   311          }
   312      });
   313  
   314      grunt.registerTask('server', function (target) {
   315          if (target === 'dist') {
   316              return grunt.task.run(['build', 'connect:dist:keepalive']);
   317          }
   318  
   319          grunt.task.run([
   320              'clean:server',
   321              'concurrent:server',
   322              'autoprefixer',
   323              'connect:livereload',
   324              'watch'
   325          ]);
   326      });
   327  
   328      grunt.registerTask('test', [
   329          'clean:server',
   330          'concurrent:test',
   331          'autoprefixer',
   332          'connect:test',
   333          'mocha'
   334      ]);
   335  
   336      grunt.registerTask('build', [
   337          'clean:dist',
   338          'jshint',
   339          'useminPrepare',
   340          'concurrent:dist',
   341          'autoprefixer',
   342          'concat',
   343          'cssmin',
   344          'ngmin',
   345          'usemin',
   346          'uglify',
   347          'copy:dist'
   348      ]);
   349  
   350      grunt.registerTask('default', [
   351          'jshint',
   352          'test',
   353          'build'
   354      ]);
   355  };