From 3babf88f655a287c74031f4c4a962f3a3cfcae2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20R=C3=B8en?= Date: Sun, 6 Jul 2014 15:55:19 +0200 Subject: [PATCH] A new hope --- index.js | 25 +++++++++---------------- package.json | 9 ++++++++- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 075823f..755d808 100644 --- a/index.js +++ b/index.js @@ -4,31 +4,24 @@ var path = require('path'); var fs = require('fs'); var autoprefixer = require('broccoli-autoprefixer'); -function AutoprefixerPlugin(options) { - this.name = 'ember-cli-autoprefixer'; - this.ext = 'css'; - this.options = options || {}; -} - -AutoprefixerPlugin.prototype.toTree = function(tree) { - return autoprefixer(tree, this.options); -}; - function EmberCLIAutoprefixer(project) { this.project = project; this.name = 'Ember CLI Autoprefixer'; } -EmberCLIAutoprefixer.prototype.treeFor = function treeFor() { +EmberCLIAutoprefixer.prototype.postprocessTree = function (type, tree) { + if (type === 'all' || type === 'styles') { + tree = autoprefixer(tree, this.options); + } + + return tree; }; EmberCLIAutoprefixer.prototype.included = function included(app) { - var registry = app.registry; this.app = app; - - var plugin = new AutoprefixerPlugin(this.app.options.autoprefixerOptions); - - registry.add('css', plugin); + this.options = this.app.options.autoprefixer; }; +EmberCLIAutoprefixer.prototype.treeFor = function treeFor() {}; + module.exports = EmberCLIAutoprefixer; diff --git a/package.json b/package.json index 0720293..ad2b4c2 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,15 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ - "ember-addon" + "ember-addon", + "autoprefixer", + "css", + "prefix", + "preprocess" ], + "ember-addon": { + "before": "broccoli-asset-rev" + }, "author": "Kim Røen", "license": "MIT", "dependencies": {