rhandom

GruntFile.js

Dec 25th, 2013
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2. module.exports = function(grunt) {
  3.  
  4.   grunt.initConfig({
  5.     jshint: {
  6.       options: {
  7.         jshintrc: '.jshintrc'
  8.       },
  9.       all: [
  10.         'Gruntfile.js',
  11.         'assets/js/*.js',
  12.         '!assets/js/scripts.min.js'
  13.       ]
  14.     },
  15.     less: {
  16.       dist: {
  17.         files: {
  18.           'assets/css/main.min.css': [
  19.             'assets/less/app.less'
  20.           ]
  21.         },
  22.         options: {
  23.           compress: true,
  24.           // LESS source map
  25.           // To enable, set sourceMap to true and update sourceMapRootpath based on your install
  26.           sourceMap: false,
  27.           sourceMapFilename: 'assets/css/main.min.css.map',
  28.           sourceMapRootpath: '/app/themes/roots/'
  29.         }
  30.       }
  31.     },
  32.     uglify: {
  33.       dist: {
  34.         files: {
  35.           'assets/js/scripts.min.js': [
  36.             'assets/js/plugins/bootstrap/transition.js',
  37.             'assets/js/plugins/bootstrap/alert.js',
  38.             'assets/js/plugins/bootstrap/button.js',
  39.             'assets/js/plugins/bootstrap/carousel.js',
  40.             'assets/js/plugins/bootstrap/collapse.js',
  41.             'assets/js/plugins/bootstrap/dropdown.js',
  42.             'assets/js/plugins/bootstrap/modal.js',
  43.             'assets/js/plugins/bootstrap/tooltip.js',
  44.             'assets/js/plugins/bootstrap/popover.js',
  45.             'assets/js/plugins/bootstrap/scrollspy.js',
  46.             'assets/js/plugins/bootstrap/tab.js',
  47.             'assets/js/plugins/bootstrap/affix.js',
  48.             'assets/js/plugins/*.js',
  49.             'assets/js/_*.js'
  50.           ]
  51.         },
  52.         options: {
  53.           // JS source map: to enable, uncomment the lines below and update sourceMappingURL based on your install
  54.           // sourceMap: 'assets/js/scripts.min.js.map',
  55.           // sourceMappingURL: '/app/themes/roots/assets/js/scripts.min.js.map'
  56.         }
  57.       }
  58.     },
  59.     version: {
  60.       options: {
  61.         file: 'lib/scripts.php',
  62.         css: 'assets/css/main.min.css',
  63.         cssHandle: 'roots_main',
  64.         js: 'assets/js/scripts.min.js',
  65.         jsHandle: 'roots_scripts'
  66.       }
  67.     },
  68.     watch: {
  69.       less: {
  70.         files: [
  71.           'assets/less/*.less',
  72.           'assets/less/bootstrap/*.less'
  73.         ],
  74.         tasks: ['less', 'version']
  75.       },
  76.       js: {
  77.         files: [
  78.           '<%= jshint.all %>'
  79.         ],
  80.         tasks: ['jshint', 'uglify', 'version']
  81.       },
  82.       livereload: {
  83.         // Browser live reloading
  84.         // https://github.com/gruntjs/grunt-contrib-watch#live-reloading
  85.         options: {
  86.           livereload: false
  87.         },
  88.         files: [
  89.           'assets/css/main.min.css',
  90.           'assets/js/scripts.min.js',
  91.           'templates/*.php',
  92.           '*.php'
  93.         ]
  94.       }
  95.     },
  96.     clean: {
  97.       dist: [
  98.         'assets/css/main.min.css',
  99.         'assets/js/scripts.min.js'
  100.       ]
  101.     }
  102.   });
  103.  
  104.   // Load tasks
  105.   grunt.loadNpmTasks('grunt-contrib-clean');
  106.   grunt.loadNpmTasks('grunt-contrib-jshint');
  107.   grunt.loadNpmTasks('grunt-contrib-uglify');
  108.   grunt.loadNpmTasks('grunt-contrib-watch');
  109.   grunt.loadNpmTasks('grunt-contrib-less');
  110.   grunt.loadNpmTasks('grunt-wp-version');
  111.  
  112.   // Register tasks
  113.   grunt.registerTask('default', [
  114.     'clean',
  115.     'less',
  116.     'uglify',
  117.     'version'
  118.   ]);
  119.   grunt.registerTask('dev', [
  120.     'watch'
  121.   ]);
  122.  
  123. };
Advertisement
Add Comment
Please, Sign In to add comment