'use strict'

const CachingWriter = require('broccoli-caching-writer')
const Minifier = require('./minifier')

class BroccoliImageMin extends CachingWriter {

    constructor(inputNodes, options) {
        super(Array.isArray(inputNodes) ? inputNodes : [inputNodes])

        this.minifier = new Minifier(options)
    }

    build() {
        return Promise.all(this.inputPaths.map(((inputPath) => {
            return this.minifier.minify(inputPath, this.outputPath)
        })))
    }
}

module.exports = BroccoliImageMin
@@ -9,26 +9,36 @@
 ict'
-%0A
+%0D%0A%0D
 %0Aconst 
-CachingWri
+BroccoliPluginAdap
 ter 
@@ -61,24 +61,25 @@
 oli-
-caching-wri
+plugin-adap
 ter')
+%0D
 %0Acon
@@ -113,17 +113,19 @@
 nifier')
-%0A
+%0D%0A%0D
 %0Aclass B
@@ -152,24 +152,34 @@
 nds 
-CachingWri
+BroccoliPluginAdap
 ter %7B
-%0A
+%0D%0A%0D
 %0A   
@@ -213,16 +213,17 @@
 tions) %7B
+%0D
 %0A       
@@ -233,63 +233,31 @@
 per(
-Array.isArray(inputNodes) ? inputNodes : %5BinputNodes%5D)%0A
+inputNodes, options)%0D%0A%0D
 %0A   
@@ -302,29 +302,54 @@
 ons)
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    
-build(
+handleContent(path, content
 ) %7B
+%0D
 %0A   
@@ -357,64 +357,43 @@
     
-return Promise.all
+if 
 (this.
+m
 in
-putPaths.map(((inputP
+ifier.matches(p
 ath)
- =%3E
+)
  %7B
+%0D
 %0A   
@@ -432,36 +432,70 @@
 nify
-(inputPath, this.outputPath)
+Buffer(content)%0D%0A        %7D else %7B%0D%0A            return content%0D
 %0A   
@@ -504,20 +504,21 @@
    %7D
-)))
+%0D
 %0A    %7D
+%0D
 %0A%7D
-%0A
+%0D%0A%0D
 %0Amod

use broccoli plugin adapter