tactivos / grunt-cdn

79 stars 53 forks source link

support for multiple sources and dest mappings #79

Open harshadyeola opened 6 years ago

harshadyeola commented 6 years ago

This is my Gruntfile section for cdn task but this is not working.

cdn: {
  x: {
    options: {
      /** @required - root URL of your CDN (may contains sub-paths as shown below) */
      cdn: '//xyz.example.com/',
      /** @optional  - if provided both absolute and relative paths will be converted */
      flatten: true,
      /** @optional  - if provided will be added to the default supporting types */
      supportedTypes: {'phtml': 'html'}
    },
    dist: {
      /** @required  - gets sources here, may be same as dest  */
      cwd: './client/x/dist',
      /** @required  - puts results here with respect to relative paths  */
      dest: './client/y/dist',
      /** @required  - files to process */
      src: ['index.html', '*.css', '{,*/}*.html', '{,**/}*.html']
    }
  },
  y: {
    options: {
      /** @required - root URL of your CDN (may contains sub-paths as shown below) */
      cdn: '//xyz.example.com/',
      /** @optional  - if provided both absolute and relative paths will be converted */
      flatten: true,
      /** @optional  - if provided will be added to the default supporting types */
      supportedTypes: {'phtml': 'html'}
    },
    dist: {
      /** @required  - gets sources here, may be same as dest  */
      cwd: './client/y/dist',
      /** @required  - puts results here with respect to relative paths  */
      dest: './client/y/dist',
      /** @required  - files to process */
      src: ['index.html', '*.css', '{,*/}*.html', '{,**/}*.html']
    }
  }  
}
grunt.registerTask('cdnify', [
        'cdn'
    ]);