gruntjs - How to write Gruntfile for Kraken Image Optimizer -


i can't figure out how write gruntfile kraken image optimizer (not krakenjs): https://github.com/kraken-io/kraken-node

for example, gruntfile grunt-contrib-imagemin looks like:

    imagemin: {                          // task         static: {                          // target             options: {                       // target options                 optimizationlevel: 3,                 //use: [mozjpeg()]             },             files: {                         // dictionary of files                 'dist/img.png': 'src/img.png', // 'destination': 'source'                 'dist/img.jpg': 'src/img.jpg',                 'dist/img.gif': 'src/img.gif'             }         },         dynamic: {                         // target             files: [{                 expand: true,                  // enable dynamic expansion                 cwd: 'src/',                   // src matches relative path                 src: ['**/*.{png,jpg,gif}'],   // actual patterns match                 dest: 'dist/'                  // destination path prefix             }]         }     }, 

however documentation using kraken on nodejs looks this:

    var kraken = require('kraken');      var kraken = new kraken({         'api_key': 'your-api-key',         'api_secret': 'your-api-secret'     });      var params = {         file: '/path/to/image/file.jpg',         wait: true     };      kraken.upload(params, function(status) {         if (status.success) {             console.log('success. optimized image url: %s', status.kraked_url);         } else {             console.log('fail. error message: %s', status.error);         }     });        // advanced api usage alter `params` object. example:      var params = {         file: '/path/to/image/file.jpg',         wait: true,         resize: {             width: 100,             height: 75,             strategy: 'crop'         },         s3_store: {             key: 'akiao4ad5j4f1na33q12',             secret: 'aawqwjsegg9wpecv20glhi5hgkxkuw5qy80t4cce',             bucket: 'assets',             path: 'images/layout/header.jpg'         },         webp: true,         lossy: true     }; 

how can convert works in gruntfile?


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -