Alex B
Alex B

Reputation: 1019

grunt-autoprefixer and grunt-postcss not working

I have tried both plugins grunt-autoprefixer and grunt-postcss but neither are adding prefixes. I have tried with something that caniuse.com says requires a prefix (cursor: grab).

Here is my autoprefixer task:

   autoprefixer: {
        dev: {
            no_dest: {
                src: 'dev/styles.css'
            }
        },
        live: {
            no_dest: {
                src: 'live/styles.css'
            }
        }
    }

And here is my postcss task:

   postcss: {
        dev: {
            options: {
                processors: [
                    require('autoprefixer-core')({browsers: 'last 1 version'}).postcss
                ]
            },
            dist: {
                src: 'dev/styles.css'
            }
        }
    }

Upvotes: 0

Views: 2930

Answers (2)

Sarbbottam
Sarbbottam

Reputation: 5570

Could you give it a try with following grunt packages

and following snippet

postcss: {
  options: {
    processors: [
      require('autoprefixer-core')({browsers: 'last 1 version'}).postcss
    ]
  },
  single_file: {
    src: 'src/main.css',
    dest: 'css/main.css'
  },
  multiple_files: [{
    expand: true,
    flatten: true,
    src: 'src/css/*.css', // -> src/css/file1.css, src/css/file2.css
    dest: 'dest/css/' // -> dest/css/file1.css, dest/css/file2.css
  }]
}

Upvotes: 1

Mario Araque
Mario Araque

Reputation: 4572

In the documentation, the configuration is different, try it:

postcss: {
    options: {
        processors: [
            require('autoprefixer-core')({browsers: 'last 1 version'}).postcss
        ]
    },
    dist: {
        src: 'dev/styles.css'
    }
}

Upvotes: 0

Related Questions