Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for disabling autoprefixer #7

Merged
merged 1 commit into from Jan 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -27,6 +27,8 @@ var app = new EmberApp({
This would prefix styles as required by the two latest version of ios, and disable the cascade (see below).
The default value for `browsers` are `['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']`.

You can disable autoprefixer by passing in `enabled: false`.

Other options, such as [cascade](https://github.com/ai/autoprefixer#visual-cascade) and [sourcemap](https://github.com/sindresorhus/broccoli-autoprefixer#sourcemap) would also go here along with `browsers`.

You can read more about this setting and others [over on the autoprefixer page](https://github.com/ai/autoprefixer#browsers) and/or the [page for broccoli-autoprefixer](https://github.com/sindresorhus/broccoli-autoprefixer#options).
Expand Down
9 changes: 7 additions & 2 deletions index.js
Expand Up @@ -3,14 +3,15 @@
var path = require('path');
var fs = require('fs');
var autoprefixer = require('broccoli-autoprefixer');
var defaults = require('lodash').defaults;

function EmberCLIAutoprefixer(project) {
this.project = project;
this.name = 'Ember CLI Autoprefixer';
}

EmberCLIAutoprefixer.prototype.postprocessTree = function (type, tree) {
if (type === 'all' || type === 'styles') {
if ((type === 'all' || type === 'styles') && this.enabled) {
tree = autoprefixer(tree, this.options);
}

Expand All @@ -19,7 +20,11 @@ EmberCLIAutoprefixer.prototype.postprocessTree = function (type, tree) {

EmberCLIAutoprefixer.prototype.included = function included(app) {
this.app = app;
this.options = this.app.options.autoprefixer;
this.options = defaults(this.app.options.autoprefixer || {}, {
enabled: true
});
this.enabled = this.options.enabled;
delete this.options.enabled;
};

EmberCLIAutoprefixer.prototype.treeFor = function treeFor() {};
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -19,7 +19,8 @@
"author": "Kim Røen",
"license": "MIT",
"dependencies": {
"broccoli-autoprefixer": "^2.0.0"
"broccoli-autoprefixer": "^2.0.0",
"lodash": "^3.0.1"
},
"repository": {
"type": "git",
Expand Down