0

I have some css files which has 'jquery' as prefix. For example, 'jquery-fancybox.css'

I am using grunt cssmin to minify the css, and using a pre-commit git hook, i am able to run the minifying.

I did a post-receive git hook on the server as well, so when i do a pull, it does the minifying as well.

When I am doing the pre-commit git hook, those css files with prefix 'jquery' can be minified, but not in the post-receive git hook.

Any idea why?

My grunt file is as below

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        files: [{
            expand: true,
            src: '**/*.js',
            dest: 'resources/front/js',
            cwd: 'assets/front/js'
        }]
      }
    },
    cssmin: {
      minify: {
        files: [{
          expand: true,
          cwd: 'assets/front/css/',
          src: ['*.css', '!*.min.css'],
          dest: 'resources/front/css/',
          ext: '.css'
        }, {
          expand: true,
          cwd: 'assets/front/css/',
          src: ['*.min.css'],
          dest: 'resources/front/css/',
          ext: '.min.css'
        }]
      }
    }

    });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');

  // Default task(s).
  grunt.registerTask('default', ['cssmin']);

};
kkh
  • 4,799
  • 13
  • 45
  • 73
  • Are you able to run `grunt cssmin` manually after pulling down new code? We need to isolate whether this is a grunt task issue or a git `post-receive` issue. – Jordan Kasper Feb 10 '14 at 19:21
  • I resolved it already. I had to use post-merge hook instead and chmod for the hook – kkh Feb 11 '14 at 09:05

1 Answers1

0

Resolved it.

Had to use a post-merge hook instead. My hook as below

#!/bin/sh
grunt

Then I had to change the permissions

chmod +x .git/hooks/post-merge
kkh
  • 4,799
  • 13
  • 45
  • 73