Advertisement
Huaba

grunt-betterCompiler

Jan 20th, 2014
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = function(grunt) {
  2.  
  3.     // Project configuration.
  4.     grunt.initConfig({
  5.         pkg: grunt.file.readJSON('package.json'),
  6.         // CONFIG ===================================/
  7.  
  8.         watch: {
  9.             compass: {
  10.                 files: ['assets/**/*.{scss,sass}'],
  11.                 tasks: ['compass:dist']
  12.             },
  13.             js: {
  14.                 files: ['assets/**/*.js'],
  15.                 tasks: ['uglify']
  16.             },
  17.             img: {
  18.                 files: ['assets/**/*.{png,jpg,jpeg,gif}'],
  19.                 tasks: ['imagemin']
  20.             }
  21.         },
  22.  
  23.         compass: {
  24.             dist: {
  25.                 options: {
  26.                     config: 'config/config.rb'
  27.                 }
  28.             }
  29.         },
  30.  
  31.         uglify: {
  32.             all: {
  33.                 files: {
  34.                     'assets/js/min/main.min.js': [
  35.                         'assets/js/libs/jquery.js',
  36.                         'assets/js/main.js'
  37.                     ]
  38.                 }
  39.             }
  40.         },
  41.  
  42.         imagemin: {
  43.             dist: {
  44.                 options: {
  45.                     optimizationLevel: 3
  46.                 },
  47.                 files: {
  48.                     'assets/img/img.png': 'assets/img/opt/img.png', // 'destination': 'source'
  49.                     'assets/img/img.jpg': 'assets/img/opt/img.jpg',
  50.                     'assets/img/img.gif': 'assets/img/opt/img.gif'
  51.                 }
  52.             }
  53.         }
  54.  
  55.  
  56. });
  57.  
  58.     // DEPENDENT PLUGINS =========================/
  59.  
  60.     grunt.loadNpmTasks('grunt-contrib-watch');
  61.     grunt.loadNpmTasks('grunt-contrib-compass');
  62.     grunt.loadNpmTasks('grunt-contrib-uglify');
  63.     grunt.loadNpmTasks('grunt-contrib-imagemin');
  64.  
  65.     // TASKS =====================================/
  66.  
  67.     grunt.registerTask('default', [
  68.         'compass:dist',
  69.         'uglify',
  70.         'imagemin',
  71.         'watch'
  72.     ]);
  73.  
  74. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement