0

I'm just trying to use autoprefixer for the first time but the task just hangs and there is no error output, so very difficult to debug.

I installed grunt-postcss and autoprefixer following the instructions on the autoprefixer github page:

npm install --save-dev grunt-postcss autoprefixer

which adds to my package.json "autoprefixer": "^6.2.2" and "grunt-postcss": "^0.7.1"

my Gruntfile.js looks like this:

module.exports = function(grunt) { 

  // Loading tasks
  grunt.loadNpmTasks('grunt-postcss');

  // Project configuration
  grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'),

    // Tasks
    postcss: {
      options: {
        processsors: [
          require('autoprefixer')({
            browsers: ['> 1%']
          })
        ]
      },
      dist: {
        src: 'src/css/apo_style.css'
      }
    }
  });

  // Registering tasks
  grunt.registerTask('postcss', ['postcss:dist']);

It seems to be a very simple and straight forward set up, but as I said, whenever I run grunt postcss the process hangs with zero feedback.

I've tried things like adding .postcss to the require line, uninstall autoprefixer and install autoprefixer-core (though this one not only hang but also told me it was deprecated...), played around with the settings... but nothing has made it better. It always hangs and nothing happens.

Any help would be very appreciated 'cause I think once I get this to work is going to become a must in my projects ;)

yago
  • 168
  • 1
  • 11

1 Answers1

1

You have two tasks with the same name, which breaks the grunt.

Just rename your task:

grunt.registerTask('some-other-name', ['postcss:dist']);

And run grunt with that name:

grunt some-other-name

And it should work just fine

jehna1
  • 3,110
  • 1
  • 19
  • 29