2016-11-23 148 views
1

我是Angular 2开发人员的新手,如果还不够,我正在尝试与Play框架集成为后端。未找到“autoprefixer”任务的插件

我试图按照有关设置了那种由丹尼斯Sinyakov一个伟大的职位:https://www.toptal.com/java/building-modern-web-applications-with-angularjs-and-play-framework

的想法是代理将进入到角应用到播放应用程序的请求。

它建议将'autoprefixer'任务作为配置中的一部分与我遇到问题。 当我开始在角应用程序,我得到以下错误:

jit-grunt: Plugin for the "autoprefixer" task not found. 

这里是我的Gruntfile.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' 
    ]); 
    }); 

欣赏关于如何安装这个插件的所有提示,并进一步上对其进行配置,如果这是必要的。

+0

这里可能相关的问题:HTTP://计算器.com/questions/36972598/grunt-jit-grunt-plugin-for-the-protractor-task-not-found尝试加载grunt.loadNpmTasks('grunt-autoprefixer');没有使用jit-grunt – Revive

+0

我已经运行'npm install grunt-autoprefixer --save-dev',添加了'grunt.loadNpmTasks('grunt-autoprefixer');'到Gruntfile.js,但我仍然得到错误**必需的配置属性“autoprefixer.server”丢失。 **。你也可以详细说明不使用jit-grunt吗?我使用Intellij来运行任务。 –

回答

1
jit-grunt: Plugin for the "autoprefixer" task not found. 

这意味着,JIT,咕噜无法找到autoprefixer模块 您可以更新的JIT咕噜这样的:

require('jit-grunt')(grunt, { 
    useminPrepare: 'grunt-usemin', 
    ngtemplates: 'grunt-angular-templates', 
    cdnify: 'grunt-google-cdn', 
    autoprefixer: 'grunt-autoprefixer', //help jit resolve autoprefixer 
    }); 

优化使用以上,但如果JIT-咕噜仍然有问题,你可以尝试添加:

grunt.loadNpmTasks('grunt-autoprefixer'); 

下一个错误消息:

**Required config property "autoprefixer.server" missing. **. 

正在出现,因为你缺少你gruntfile的autoprefixer.server目标确保其声明如下:

autoprefixer: { 
    server:{ 
     options: { 
      // Task-specific options go here. 
     }, 
     your_target: { 
      // Target-specific file lists and/or options go here. 
     }, 
    }, 
    }, 

https://github.com/nDmitry/grunt-autoprefixer正确选择和使用

+0

似乎'require('jit-grunt ...''似乎已经足够了,并且我发现添加'require('load-grunt-tasks')(grunt)'',而不是,有人仍然会遇到问题,谢谢你的回答。 –