Grunt post css не добавляет префиксы - PullRequest
0 голосов
/ 26 апреля 2020

Я пытался использовать grunt с плагином post css, и после успешного завершения задания я открыл файл style. css и обнаружил, что ни один префикс не был добавлен. Вы можете увидеть консольное сообщение и пакет Grunt. js +. json файлы ниже. Пожалуйста, помогите мне выяснить, что я делаю неправильно. Заранее спасибо!

Консольное сообщение

Запуск "post css: dist" (post css) задание 1, обработанная таблица стилей создана.

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.initConfig({
    less: {
      development: {
        options: {
          compress: true,
          yuicompress: true,
          optimization: 2
        },
        files: {
          "css/style.css": "less/style.less" 
        }
      }
    },
    postcss: {
        style: {
          options: {
            processors: [
              require('autoprefixer')()
            ]
          }
        },
        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']);
};

Пакет. json

{
  "name": "my-super-amazing-app",
  "version": "1.0.0",
  "private": true,
  "repository": {
    "type": "git",
    "url": "git://github.com/i1kom/BarbershopExtended.git"
  },
  "devDependencies": {
    "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"
  },
  "dependencies": {
    "grunt": "^1.1.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  }
}
...