我正在尝试使用 autoprefixer css 后处理器。我正在学习教程并安装了 npm。package.json
使用 npm,然后我使用该文件在我的项目根目录中安装了 grunt 和 autoprefixer : https ://github.com/nDmitry/grunt-autoprefixer/blob/master/package.json
按照教程,然后Gruntfile.js
我在我的项目根目录中创建了这个:
module.exports = function (grunt) {
grunt.initConfig({
autoprefixer: {
dist: {
files: {
'build/style.css': 'style.css'
}
}
},
watch: {
styles: {
files: ['style.css'],
tasks: ['autoprefixer']
}
}
});
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-watch');
};
之后,本教程建议使用 Grunt Watch 使用
./node_modules/.bin/grunt watch
这导致
-bash: ./node_modules/.bin/grunt: No such file or directory
我还尝试导航到项目中的 grunt 文件夹,然后显示
-bash: node_modules/grunt: is a directory
我在我的本地用户文件夹中也有一个node_modules
文件夹,但是解决该文件夹 grunt 也只是告诉我它是一个文件夹。
请帮助我,为什么这不起作用?我愿意真正学习 grunt,但我什至无法使用入门指南开始...