【发布时间】:2013-10-15 23:55:45
【问题描述】:
我正在尝试使用 autoprefixer css 后处理器。我正在学习教程并安装了 npm。使用 npm,然后我使用 package.json 文件在我的项目根目录中安装了 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,但我什至无法使用入门指南开始...
【问题讨论】:
标签: javascript node.js terminal gruntjs grunt-contrib-watch