package assets

import (
	"io"
	"os/exec"

	"gnd.la/log"
)

var (
	cleanCSSPath, _ = exec.LookPath("cleancss")
)

type cssBundler struct {
}

func (c *cssBundler) Bundle(w io.Writer, r io.Reader, opts Options) error {
	if cleanCSSPath != "" {
		return command(cleanCSSPath, []string{"--s0"}, w, r, opts)
	}
	p, n, err := reducer("css", w, r)
	if err != nil {
		return err
	}
	log.Debugf("Reduced CSS size from %d to %d bytes", p, n)
	return err
}

func (c *cssBundler) Type() Type {
	return TypeCSS
}

func init() {
	RegisterBundler(&cssBundler{})
}

package assets

import (
	"gnd.la/log"
	"io"
)

type cssBundler struct {
}

func (c *cssBundler) Bundle(w io.Writer, r io.Reader, opts Options) error {
	p, n, err := reducer("css", w, r)
	if err != nil {
		return err
	}
	log.Debugf("Reduced CSS size from %d to %d bytes", p, n)
	return err
}

func (c *cssBundler) Type() Type {
	return TypeCSS
}

func init() {
	RegisterBundler(&cssBundler{})
}

--- 
+++ 
@@ -1,14 +1,23 @@
 package assets
 
 import (
+	"io"
+	"os/exec"
+
 	"gnd.la/log"
-	"io"
+)
+
+var (
+	cleanCSSPath, _ = exec.LookPath("cleancss")
 )
 
 type cssBundler struct {
 }
 
 func (c *cssBundler) Bundle(w io.Writer, r io.Reader, opts Options) error {
+	if cleanCSSPath != "" {
+		return command(cleanCSSPath, []string{"--s0"}, w, r, opts)
+	}
 	p, n, err := reducer("css", w, r)
 	if err != nil {
 		return err
Add support for bundling CSS locally with cleancss
