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 new targets feature in ember-cli. #34

Merged
merged 1 commit into from Apr 22, 2017
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
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -10,8 +10,9 @@ ember install ember-cli-autoprefixer
```

## Options
You can configure what browsers to target and other options by specifying them in your
`ember-cli-build.js` (or `Brocfile.js`). An example:
By default ember-cli-autoprefixer passes your projects target browsers (in Ember CLI >= 2.13.0)
to autoprefixer. However, you can manually configure what browsers to target and other options by
specifying them in your `ember-cli-build.js` (or `Brocfile.js`). An example:

```js
var app = new EmberApp(defaults, {
Expand Down
7 changes: 6 additions & 1 deletion index.js
Expand Up @@ -6,20 +6,25 @@ var defaults = require('lodash/defaults');

module.exports = {
name: 'ember-cli-autoprefixer',
included: function(app, parentAddon) {

included: function(app) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're node 4 we can use shorthand syntax.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, but that sounds like something that should be handled separately.

this.app = app;

if (typeof app.import !== 'function' && app.app) {
this.app = app = app.app;
}

this._super.included.apply(this, arguments);

this.options = defaults(this.app.options.autoprefixer || {}, {
browsers: this.project.targets && this.project.targets.browsers,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's super convenient that both use the same syntax.

enabled: true
});

this.enabled = this.options.enabled;
delete this.options.enabled;
},

postprocessTree: function(type, tree) {
if ((type === 'all' || type === 'styles') && this.enabled) {
tree = autoprefixer(tree, this.options);
Expand Down