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

Allow multiple pre-processors per type. #1918

Merged
merged 1 commit into from
Sep 7, 2014

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 7, 2014

  • Registry.prototype.load always returns an array of plugins available.
  • The preprocess helper functions chain each plugins output tree into the next ones input.

@stefanpenner
Copy link
Contributor

Lgtm

rwjblue added a commit that referenced this pull request Sep 7, 2014
@rwjblue rwjblue merged commit 7a7cc18 into ember-cli:master Sep 7, 2014
@rwjblue rwjblue deleted the multiple-preprocessors-per-type branch September 7, 2014 03:21
@mbykovskyy
Copy link

What about preprocessors registered by addons as objects. They won't be part ofavailablePlugins.

@rwjblue
Copy link
Member Author

rwjblue commented Sep 12, 2014

Yes, they should be (ember-cli-esnext does this and works well alongside ember-cli-coffeescript for example). Please provide me an example where this is not true. Happy to track it down and fix if it is an oversight...

@mbykovskyy
Copy link

Yeah I was just looking at your ember-cli-esnext addon and wondering how it was working but mine wasn't. Your preprocessor has the same name as the addon itself while mine doesn't.

So I'm wondering what is the convention here. Do all preprocessors have to have the same name as the addon which has been installed via npm install? What about addons that have multiple preprocessors?

As an example say I have this addon:

'use strict';

module.exports = {
  name: 'ember-cli-addon',
  included: function(app) {
    app.registry.add('js', {
      name: 'ember-cli-preprocessor1',
      ext: 'js',
      toTree: function(tree) {}
    });

    app.registry.add('js', {
      name: 'ember-cli-preprocessor2',
      ext: 'js',
      toTree: function(tree) {}
    });

    app.registry.add('template', {
      name: 'ember-cli-preprocessor3',
      ext: 'hbs',
      toTree: function(tree) {}
    });
  }
};

@rwjblue
Copy link
Member Author

rwjblue commented Sep 12, 2014

Yes, that is a bug, if(this.availablePlugins.hasOwnProperty(plugin.name)) { basically prevents non-package preprocessors from working correctly.

@mbykovskyy - Can you open an issue with these last two comments in the subject? Shouldn't take long for me to fix, I just don't want to loose track...

@mbykovskyy
Copy link

Yeah no problem.

@mbykovskyy
Copy link

@rwjblue I made a quick change to my addon to make it work with the current change but I'm still not getting what I'm expecting. I'll comment under the appropriate line.

@rwjblue
Copy link
Member Author

rwjblue commented Sep 13, 2014

Submitted #1987 to fix the preprocessing chaining issue mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants