Xulai / broccoli-imagemin

Use imagemin in your broccoli build pipeline
ISC License
7 stars 2 forks source link

Define destdir #1

Open Globegitter opened 10 years ago

Globegitter commented 10 years ago

I am just trying to use your plugin, which works pretty great, but when I run for example broccoli build dist it copies the images directly into the dist folder rather than into an img subfolder.

Even trying to use something like https://github.com/mjackson/broccoli-select doesn't seem to work.

So how can I define a destination folder/subfolder where all the images get copied into?

djmadeira commented 9 years ago

I know this is ancient and you've probably either moved on or solved it yourself, but for anybody who comes across this later: You can use broccoli-static-compiler to do this, for example:

var images = 'src/images';
images = pickFiles(images, {
  srcDir: '/',
  files: ['**/*.{gif,svg,png,jpg,jpeg}'],
  destDir: '/img'
});
images = imagemin(images, {
  progressive: true
});

where "destDir" is the relevant option there.