Javascript 插件为";“自动刷新器”;找不到任务
我是Angular 2开发的新手,如果这还不够的话,我会尝试将Play框架集成到后端 我正试图关注丹尼斯·辛亚科夫(Denis Sinyakov)关于这种设置的一篇精彩文章: 其思想是将传入Angular应用程序的请求代理到Play应用程序 它建议将“autoprefixer”任务作为我遇到问题的配置的一部分。 启动Angular应用程序时,出现以下错误:Javascript 插件为";“自动刷新器”;找不到任务,javascript,angularjs,angular,gruntjs,Javascript,Angularjs,Angular,Gruntjs,我是Angular 2开发的新手,如果这还不够的话,我会尝试将Play框架集成到后端 我正试图关注丹尼斯·辛亚科夫(Denis Sinyakov)关于这种设置的一篇精彩文章: 其思想是将传入Angular应用程序的请求代理到Play应用程序 它建议将“autoprefixer”任务作为我遇到问题的配置的一部分。 启动Angular应用程序时,出现以下错误: jit-grunt: Plugin for the "autoprefixer" task not found. 下面是我的Grunfil
jit-grunt: Plugin for the "autoprefixer" task not found.
下面是我的Grunfile.js中可能感兴趣的部分
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Automatically load required Grunt tasks
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn'
});
// Configurable paths for the application
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'dist'
};
还有这个
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'autoprefixer:server',
'configureProxies:server',
'connect:livereload',
'watch'
]);
});
感谢所有关于如何安装此插件的提示,并在必要时进一步配置它
jit-grunt: Plugin for the "autoprefixer" task not found.
这意味着jit grunt无法找到autoprefixer模块
您可以像这样更新jit grunt:
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn',
autoprefixer: 'grunt-autoprefixer', //help jit resolve autoprefixer
});
autoprefixer: {
server:{
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
},
最好使用上述方法,但如果jit grunt仍然存在问题,您可以尝试添加:
grunt.loadNpmTasks('grunt-autoprefixer');
下一个错误消息:
**Required config property "autoprefixer.server" missing. **.
出现的原因是您缺少GrunFile中的autoprefixer.server
目标。请确保声明如下:
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn',
autoprefixer: 'grunt-autoprefixer', //help jit resolve autoprefixer
});
autoprefixer: {
server:{
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
},
有关正确的选项和用法,请参见此处的可能的相关问题:尝试加载grunt.loadNpmTasks(“grunt-autoprefixer”);在不使用jit gruntI的情况下,我运行了“npm安装grunt autoprefixer--save dev”,添加了“grunt.loadNpmTasks('grunt-autoprefixer');”到Gruntfile.js,但我仍然得到错误**缺少必需的配置属性“autoprefixer.server”。*。您还可以详细说明不使用jit grunt吗?我使用Intellij来运行任务。似乎“require('jit-grunt…')就足够了。此外,我发现添加“require('load-grunt-tasks')(grunt);”也可以,以防有人仍然有问题。谢谢你的回答。