Skip to content

support 'mixinsources' option - #131

Merged
bajtos merged 1 commit into
strongloop:masterfrom
PradnyaBaviskar:lb-issue-79-mixinsources
May 7, 2015
Merged

support 'mixinsources' option#131
bajtos merged 1 commit into
strongloop:masterfrom
PradnyaBaviskar:lb-issue-79-mixinsources

Conversation

@PradnyaBaviskar

Copy link
Copy Markdown
Contributor

In continuation with - #79, added support for mixinSources option.

The implementation -

  • By default looks for mixinsources in mixins directory
  • Loads only mixins used through models

Connect to #79

@bajtos - Can you review?

Comment thread lib/compiler.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am proposing to move this filtering code out of "loadMixins" to keep "loadMixins" simpler and focused on doing one thing only.

@bajtos bajtos self-assigned this Apr 30, 2015
@PradnyaBaviskar
PradnyaBaviskar force-pushed the lb-issue-79-mixinsources branch from 7099aa7 to 4e15c52 Compare April 30, 2015 12:57
Comment thread lib/compiler.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This may create duplicate items in the mixins array, when the same mixin is loaded from mixinDirs and mixinSources, is that correct? In which case you should de-duplicate the instructions.

@PradnyaBaviskar
PradnyaBaviskar force-pushed the lb-issue-79-mixinsources branch from 4e15c52 to 7f11a15 Compare May 5, 2015 13:41
@PradnyaBaviskar

Copy link
Copy Markdown
Contributor Author

@bajtos - Addressed your comments above and have also added a few more test cases.

Can you please review?

Comment thread lib/compiler.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find this difficult to grasp at the first sight, it looks like loadMixins should be modifying the files variable.

@bajtos

bajtos commented May 5, 2015

Copy link
Copy Markdown
Member

The implementation looks good in general now, although I find it difficult to understand the implementation in compiler. Can you please try to simplify it a bit more, using my comments above for inspiration? Don't worry about it too much. If the result does not look better than the current solution or it takes too much time, then I am ok to land the patch as it is now.

@PradnyaBaviskar
PradnyaBaviskar force-pushed the lb-issue-79-mixinsources branch 2 times, most recently from d460161 to 77c8c60 Compare May 6, 2015 13:29
@PradnyaBaviskar

Copy link
Copy Markdown
Contributor Author

@bajtos - Done with the changes suggested by you. Please review. 77c8c60

Comment thread lib/compiler.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nitpick: please rename to findMixinDefinitions (plural).

- By default looks for mixinsources in  directory

- Loads only mixins used through models
@PradnyaBaviskar
PradnyaBaviskar force-pushed the lb-issue-79-mixinsources branch from 77c8c60 to 53f5182 Compare May 7, 2015 09:06
@PradnyaBaviskar

Copy link
Copy Markdown
Contributor Author

Reworked on loadMixins, so that it returns lookup table, and not an array.

bajtos added a commit that referenced this pull request May 7, 2015
@bajtos
bajtos merged commit 140180f into strongloop:master May 7, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants