laktek / punch

A fun and easy way to build modern websites
http://laktek.github.com/punch
MIT License
1.17k stars 107 forks source link

Trouble Implementing Autoprefixer compiler/minifier #126

Open ethagnawl opened 8 years ago

ethagnawl commented 8 years ago

I'd like to implement an autoprefixer pre-processor. However, I'm not clear if this qualifies as a compiler, minifier, etc. I've tried all of the above to no avail.

Here's my most recent attempt at getting anything working:

// ./autoprefixer.js
module.exports = {
    input_extensions: [".css"],
    force_compile: true,
    compile: function(input, filename, callback){
        return callback(null, "*{color: red;}");
    }
};
// config.json
...
    "plugins": {
        "compilers": {
            ".css": "punch-sass-compiler",
            ".css": "autoprefixer"
        }
    }
...
/home/peter/projects/website/node_modules/punch/lib/asset_bundler.js:62
                        if (compiler && compiler.input_extensions.indexOf(template_extension) > -1)
                                                                 ^
TypeError: Cannot read property 'indexOf' of undefined
  at /home/peter/projects/website/node_modules/punch/lib/asset_bundler.js:62:45
  at /home/peter/projects/website/node_modules/punch/lib/template_handler.js:119:11
  at fs.js:334:14
  at /home/peter/projects/website/node_modules/punch/node_modules/fstream/node_modules/graceful-fs/graceful-fs.js:42:10
  at FSReqWrap.oncomplete (fs.js:95:15)