1

我安装了 grunt-postcss 和 autoprefixer 插件,但是当我尝试使用插件“ load-grunt-config ”、Autoprefixer 和其他插件的方法配置 PostCSS 时,什么都不做,也没有提示或错误。

这是控制台的输出:

$ grunt postcss
Running "postcss:postcss" (postcss) task
Done.

当我以标准方式配置 grunt 时,PostCSS 可以正常工作。

这是我的 postcss.js 文件,放在 grunt 文件夹中:

module.exports = {
  postcss: {
    options: {
      processors: [
        require('autoprefixer')(),
      ]
    },
    dist: {
      src: '<%= project.stylesheets %>/src/main.css',
      dest: '<%= project.stylesheets %>/dest/main.css'
    }
  }
};

相反,使用这个命令grunt postcss --debug,控制台会显示:

Running "postcss:postcss" (postcss) task
[D] Task source: /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-postcss/tasks/postcss.js
Done.

或者这个命令行$grunt postcss --verbose,控制台显示这个:

$ grunt postcss --verbose
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Initializing config...OK

Registering "grunt-bowercopy" local Npm module tasks.
Reading /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-bowercopy/package.json...OK
Parsing /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-bowercopy/package.json...OK
Reading bower.json...OK
Parsing bower.json...OK
Loading "bowercopy.js" tasks...OK
+ bowercopy

Registering "grunt-contrib-sass" local Npm module tasks.
Reading /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-contrib-sass/package.json...OK
Parsing /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-contrib-sass/package.json...OK
Loading "sass.js" tasks...OK
+ sass

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-contrib-watch/package.json...OK
Parsing /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch

Registering "grunt-modernizr" local Npm module tasks.
Reading /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-modernizr/package.json...OK
Parsing /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-modernizr/package.json...OK
Loading "modernizr.js" tasks...OK
+ modernizr

Registering "grunt-postcss" local Npm module tasks.
Reading /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-postcss/package.json...OK
Parsing /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-postcss/package.json...OK
Loading "postcss.js" tasks...OK
+ postcss

Registering "grunt-slim" local Npm module tasks.
Reading /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-slim/package.json...OK
Parsing /Users/mario.montalto/Progetti/start-web-site/frontend/node_modules/grunt-slim/package.json...OK
Loading "slim.js" tasks...OK
+ slim
Loading "Gruntfile.js" tasks...OK
+ default

Running tasks: postcss

Running "postcss" task

Running "postcss:postcss" (postcss) task
Verifying property postcss.postcss exists in config...OK
File: [no files]
Options: processors=[null], map, diff=false, safe=false, failOnError=false, writeDest

Done.

你不知道如何解决它

谢谢你的帮助

马里奥

4

0 回答 0