我只是第一次尝试使用自动修复程序,但是任务挂起了,没有错误输出,所以很难调试。
我按照autoprefixer github page上的说明安装了grunt-postcss和autoprefixer
npm install --save-dev grunt-postcss autoprefixer添加到我的package.json "autoprefixer": "^6.2.2"和"grunt-postcss": "^0.7.1"中
我的Gruntfile.js看起来像这样:
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']);这似乎是一个非常简单和直接的设置,但正如我所说的,每当我运行grunt postcss时,进程都会挂起,没有反馈。
我尝试过将.postcss添加到require行,卸载autoprefixer并安装autoprefixer-core (尽管这个命令不仅挂起,而且还告诉我它已被弃用...),尝试过各种设置……但没有什么能让它变得更好。它总是挂起,什么也不会发生。
任何帮助都将是非常感谢的,因为我认为一旦我得到这个工作,将成为我的项目中的一个必备项目;)
发布于 2015-12-29 22:40:35
您有两个同名的任务,这打破了单调。
只需重命名您的任务:
grunt.registerTask('some-other-name', ['postcss:dist']);
并使用该名称运行grunt:
grunt some-other-name
它应该工作得很好。
https://stackoverflow.com/questions/34512853
复制相似问题