【发布时间】:2015-03-03 16:29:27
【问题描述】:
我安装了当前版本的 npm,一切似乎都还不错:
自动前缀加载得很好:
我在本地项目文件夹中创建了一个文件'Grunfile.js':
我在 Windows 8.1 上运行它
从这里到哪里?我如何告诉 grunt 检查文件?如何从命令行调用该函数?还是我从命令行调用函数?
【问题讨论】:
标签: gruntjs
我安装了当前版本的 npm,一切似乎都还不错:
自动前缀加载得很好:
我在本地项目文件夹中创建了一个文件'Grunfile.js':
我在 Windows 8.1 上运行它
从这里到哪里?我如何告诉 grunt 检查文件?如何从命令行调用该函数?还是我从命令行调用函数?
【问题讨论】:
标签: gruntjs
在您的目录中,您需要有 2 个文件,package.json 和 Gruntfile.js。要创建 package.json 文件,请运行命令 npm init。
接下来,您需要将 grunt-autoprefixer 任务添加到您的 package.json 文件中,您可以通过运行 npm install grunt-autoprefixer --save-dev 来完成此操作。
然后,在 Gruntfile.js 中,它应该看起来像这样:
module.exports = function(grunt) {
grunt.initConfig({
autoprefixer: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.registerTask('default', [
'autoprefixer'
]);
};
有关在 autoprefixer 上编辑设置的更多详细信息,请查看文档:https://github.com/nDmitry/grunt-autoprefixer
要了解有关 Grunt 的更多信息,请查看https://learngrunt.com
【讨论】: