nDmitry / grunt-autoprefixer

Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. Based on Autoprefixer.
MIT License
795 stars 60 forks source link

Grunt autoprefixer is not adding prefixes #130

Open i1kom opened 4 years ago

i1kom commented 4 years ago

I just started using grunt and autoprefixor and faced with next issue. When i run the grunt task everything is finising sucsessfully and consol show message:

Running "postcss:dist" (postcss) task
>> 1 processed stylesheet created. 

But when i open css file i see that no one prefix was not added. I also post Grunt.js and package.json code below. Pls help me to figure out what i did wrong. Will be happy to get any advise. Thank you in advance!

Grunt.js

module.exports = function(grunt) {
 grunt.loadNpmTasks('grunt-browser-sync');
 grunt.loadNpmTasks('grunt-contrib-less');
 grunt.loadNpmTasks('grunt-contrib-watch');
 grunt.loadNpmTasks('grunt-postcss');
 grunt.loadNpmTasks('grunt-posthtml');

  grunt.initConfig({
    less: {
      development: {
        options: {
          compress: true,
          yuicompress: true,
          optimization: 2
        },
        files: {
          "css/style.css": "less/style.less" 
        }
      }
    },
    postcss: {
        style: {
          options: {
          autoprefixer: { grid: true },
          map: {
            inline: true,
          },
        processors: [
              require('autoprefixer')([
          "last 6 versions"
        ])
            ]
          }
        },
        dist: {
            files: {
              "css/style.css": "css/style.css"
            }
        }
    },
    watch: {
      styles: {
        files: ['less/**/*.less'], 
        tasks: ['less', 'postcss'],
        options: {
          nospawn: true,
          livereload: false
        }
      }
    },
    browserSync: {
        bsFiles: {
            src : [
                'css/*.css',
                '*.html'
                ]
        },
        options: {
            watchTask: true,
            notify: false,
            server: {
                baseDir: "./"
            }
        }
    }
});

    grunt.registerTask('default', ['browserSync', 'less', 'postcss', 'watch']);
};

Package.json

{
  "name": "my-super-amazing-app",
  "version": "1.0.0",
  "private": true,
   "browserslist": [
    "> 1%",
    "last 6 versions",
    "ie 6-8",
    ">= 5%",
    "ie 6-8"
  ],
  "repository": {
    "type": "git",
    "url": "git://github.com/i1kom/BarbershopExtended.git"
  },
  "devDependencies": {
    "autoprefixer": "^9.7.6",
    "grunt-autoprefixer": "^3.0.4",
    "grunt-browser-sync": "^2.2.0",
    "grunt-contrib-connect": "^2.1.0",
    "grunt-contrib-less": "^2.0.0",
    "grunt-contrib-watch": "^1.1.0",
    "grunt-postcss": "^0.9.0",
    "grunt-posthtml": "^0.5.0"
  },
  "dependencies": {
    "grunt": "^1.1.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {
        "grid": true
      }
    }
  }
}