Anjum....
Anjum....

Reputation: 4204

Getting error while using grunt-cdnify

I am using grunt-cdnify for CDN my web assets. I am using below configuration as mention in REMADME.md file.

 cdnify: {
  makeItAws: {
    options: {
      base: 'http://my.cdn.com/'
    },
    files: [{
      expand: true,
      cwd: '<%= app.dist %>',
      src: '**/*.{css,html,js}',
      dest: '<%= app.dist %>'
    }]
  }
},

My grunt task register

grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin',
'cdnify' 
]);

I am getting this below error

Anjums-MacBook-Pro:project anjum$ grunt cdnify
Running "cdnify:makeItAws" (cdnify) task

Warning: An error occurred while processing a template 
(Cannot read property 'dist' of undefined). Use --force to continue.

Aborted due to warnings.


Execution Time (2015-02-08 08:42:51 UTC)
loading tasks     3ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 33%
cdnify:makeItAws  5ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 56%
Total 9ms

Any idea where I am going wrong? Please direct me. Thanks

Upvotes: 0

Views: 2122

Answers (3)

Bruno Peres
Bruno Peres

Reputation: 3256

To run a task as grunt cdnify you must register a cdnify grunt task as

grunt.registerTask('cdnify', [
    'cdnify' 
]);

on your Gruntfile.js

Upvotes: 0

Bruno Peres
Bruno Peres

Reputation: 3256

Perhaps some tasks are missing on your local npm packages, try

npm install

To install the packages from you package.json file, then try grunt cdnify again

Upvotes: 0

syonip
syonip

Reputation: 2971

This isn't a problem with cdnify, it's because your config variable "app" is undefined. Make sure you define app correctly in the config section in your gruntfile, for example:

grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    app: {
      dist: 'dist'
    },
    etc...

Upvotes: 1

Related Questions