1

I am new to Angular 2 development and if it was not enough i am trying to integrate with the Play framework being the back-end side.

I am trying to follow a great post about the set-up of that kind by Denis Sinyakov: https://www.toptal.com/java/building-modern-web-applications-with-angularjs-and-play-framework

The idea is to proxy the requests incoming to the Angular app to the Play app.

It it suggested to include the 'autoprefixer' task as part of the configuration with which i encounter problems. When i start the Angular app i get following error:

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

Here are parts of my Gruntfile.js which may be of interest.

// 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'
  };

and this

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'
    ]);
  });

Appreciate all tips on how to install this plugin and configure it further on if that is necessary.

Maciej Kowalski
  • 25,605
  • 12
  • 54
  • 63
  • Possible related question here: http://stackoverflow.com/questions/36972598/grunt-jit-grunt-plugin-for-the-protractor-task-not-found Try loading grunt.loadNpmTasks('grunt-autoprefixer'); without using jit-grunt – Revive Nov 23 '16 at 11:28
  • I have run 'npm install grunt-autoprefixer --save-dev', added 'grunt.loadNpmTasks('grunt-autoprefixer');' to the Gruntfile.js, but i still get error **Required config property "autoprefixer.server" missing. **. Also can you elaborate more on not using jit-grunt? I use Intellij to run tasks. – Maciej Kowalski Nov 23 '16 at 12:29

1 Answers1

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

This means that jit-grunt cannot locate the autoprefixer module You can update jit-grunt like this:

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

Optimally use above but if jit-grunt still has issues you can try add:

grunt.loadNpmTasks('grunt-autoprefixer');

The next error message:

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

Is appearing because you are missing the autoprefixer.server target in your gruntfile make sure it is declared like this:

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

See https://github.com/nDmitry/grunt-autoprefixer for correct options and usage

Revive
  • 2,248
  • 1
  • 16
  • 23
  • It seems that the 'require('jit-grunt...' seems to be enough. Also i found out that adding 'require('load-grunt-tasks')(grunt);' instead, works also just in case someone would still have problems. Thanks for the answer. – Maciej Kowalski Nov 23 '16 at 19:00