ThomasRedstone

Gruntfile.js

Feb 5th, 2015
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*global module:false*/
  2. module.exports = function(grunt) {
  3.  
  4.     grunt.loadNpmTasks('grunt-composer');
  5.     // These plugins provide necessary tasks.
  6.     grunt.loadNpmTasks('grunt-contrib-concat');
  7.     grunt.loadNpmTasks('grunt-concat-css');
  8.     grunt.loadNpmTasks('grunt-contrib-less');
  9.     grunt.loadNpmTasks('grunt-contrib-uglify');
  10.     grunt.loadNpmTasks('grunt-contrib-nodeunit');
  11.     grunt.loadNpmTasks('grunt-contrib-jshint');
  12.     grunt.loadNpmTasks('grunt-contrib-copy');
  13.     grunt.loadNpmTasks('grunt-contrib-watch');
  14.     grunt.loadNpmTasks('grunt-bower-task');
  15.     grunt.loadNpmTasks('grunt-githooks');
  16.     grunt.loadNpmTasks('grunt-parallel-behat');
  17.  
  18.  
  19.     // Project configuration.
  20.     grunt.initConfig({
  21.         // Metadata.
  22.         pkg: grunt.file.readJSON('package.json'),
  23.         banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  24.             '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  25.             '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  26.             '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  27.             ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  28.         // Task configuration.
  29.         less: {
  30.             development: {
  31.                 options: {
  32.                     compress: false, // true, //minifying the result
  33.                 },
  34.                 files: {
  35.                     //"../app/assets/stylesheets/styles.css": "../app/assets/less/styles.less",
  36.                     "../app/assets/stylesheets/bootstrap.css": "../app/assets/less/bootstrap.less",
  37.                 }
  38.             }
  39.         },
  40.         concat_css: {
  41.             options: {
  42.                 // Task-specific options go here.
  43.             },
  44.             styles: {
  45.                 src: [
  46.                     '../app/assets/stylesheets/bootstrap.css',
  47.                     './assets/jquery-ui/themes/smoothness/jquery-ui.css'
  48.                 ],
  49.                 dest: '../public/simple-blue/assets/stylesheets/styles.css'
  50.             }
  51.         },
  52.         concat: {
  53.             options: {
  54.                 separator: ';',
  55.             },
  56.             scripts: {
  57.                 src: [
  58.                     './assets/jquery/dist/jquery.js',
  59.                     './assets/jquery-ui/jquery-ui.js',
  60.                     './lib/jquery-ui/jquery-ui.js',
  61.                     './assets/matchHeight/jquery.matchHeight.js',
  62.                     './assets/bootstrap/dist/js/bootstrap.js',
  63.                     '../app/assets/js/scripts.js'
  64.                 ],
  65.                 dest: './assets/js/scripts_final.js'
  66.             },
  67.         },
  68.         uglify: {
  69.             options: {
  70.                 mangle: true
  71.             },
  72.             scripts: {
  73.                 src: './assets/js/scripts_final.js',
  74.                 dest: '../public/simple-blue/assets/js/scripts.js'
  75.             }
  76.         },
  77.         jshint: {
  78.             options: {
  79.                 curly: true,
  80.                 eqeqeq: true,
  81.                 immed: true,
  82.                 latedef: true,
  83.                 newcap: true,
  84.                 noarg: true,
  85.                 sub: true,
  86.                 undef: true,
  87.                 unused: true,
  88.                 boss: true,
  89.                 eqnull: true,
  90.                 globals: {}
  91.             },
  92.             gruntfile: {
  93.                 src: 'Gruntfile.js'
  94.             },
  95.         },
  96.         copy: {
  97.             bootstrap_fonts: {
  98.                 files: [
  99.                     // includes files within path
  100.                     {
  101.                         expand: true,
  102.                         flatten: true,
  103.                         src: ['./lib/bootstrap/fonts/*'],
  104.                         dest: '../public/simple-blue/assets/fonts/',
  105.                         filter: 'isFile'
  106.                     },
  107.                     {
  108.                         expand: true,
  109.                         flatten: true,
  110.                         src: ['./assets/jquery-ui/themes/smoothness/images/*'],
  111.                         dest: '../public/simple-blue/assets/stylesheets/images/',
  112.                         filter: 'isFile'
  113.                     },
  114.                 ]
  115.             }
  116.         },
  117.         bower: {
  118.             install: {
  119.                 //just run 'grunt bower:install' and you'll see files from your Bower packages in lib directory
  120.             }
  121.         },
  122.         behat: {
  123.             options: {
  124.                 config: '../behat.yml',
  125.                 maxProcesses: 5,
  126.                 bin: '../vendor/bin/behat'
  127.             }
  128.         },
  129.         run: {
  130.             options: {
  131.                 config: '../behat.yml',
  132.                 maxProcesses: 5,
  133.                 bin: '../vendor/bin/behat'
  134.             }
  135.         },
  136.         composer: {
  137.             options: {
  138.                 usePhp: true,
  139.                 flags: [],
  140.                 composerLocation: '/usr/local/bin/composer',
  141.                 cwd: '../'
  142.             }
  143.         },
  144.         githooks: {
  145.             all: {
  146.                 options: {
  147.                     dest: '../.git/hooks/'
  148.                 },
  149.                 'pre-commit': 'pre-commit',
  150.                 'merge': 'merge',
  151.             }
  152.         },
  153.         shell: {
  154.             multiple: {
  155.                 command: [
  156.                     'mkdir test',
  157.                     'cd test',
  158.                     'ls'
  159.                 ].join(';')
  160.             }
  161.         },
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.         watch: {
  169.             js_frontend: {
  170.                 files: [
  171.                     //watched files
  172.                     './lib/jquery/dist/jquery.js',
  173.                     './lib/jquery-ui/jquery-ui.js',
  174.                     './lib/matchHeight/jquery.matchHeight-min.js',
  175.                     './lib/bootstrap/dist/js/bootstrap.js',
  176.                     '../app/assets/js/scripts.js'
  177.                 ],
  178.                 tasks: ['concat', 'uglify'], //tasks to run
  179.                 options: {
  180.                     livereload: true //reloads the browser
  181.                 }
  182.             },
  183.             styles: {
  184.                 files: ['./lib/bootstrap/less/*.less',
  185.                     '../app/assets/less/*.less'
  186.                 ], //watched files
  187.                 tasks: ['less', 'concat_css'], //tasks to run
  188.                 options: {
  189.                     livereload: true //reloads the browser
  190.                 }
  191.             },
  192.             fonts: {
  193.                 files: ['./lib/bootstrap/fonts/*'],
  194.                 tasks: ['copy'],
  195.                 options: {
  196.                     livereload: true
  197.                 }
  198.             }
  199.             //tests: {
  200.             //  files: ['app/controllers/*.php','app/models/*.php'],  //the task will run only when you save files in this location
  201.             //  tasks: ['phpunit']
  202.             //}
  203.         }
  204.     });
  205.  
  206.     // Default task.
  207.     //grunt.registerTask('default', ['jshint', 'nodeunit', 'concat', 'uglify', 'less']);
  208.     grunt.registerTask('default', ['concat', 'uglify', 'less', 'concat_css', 'copy']);
  209.     grunt.registerTask('pre-commit', ['composer:install', 'behat', 'phpspec']);
  210.     grunt.registerTask('merge', ['concat', 'uglify', 'less', 'concat_css', 'copy', 'behat']);
  211.     grunt.registerTask('build', ['bower:install', 'concat', 'uglify', 'less', 'concat_css', 'copy']);
  212.  
  213. };
Advertisement
Add Comment
Please, Sign In to add comment