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

Addon author guide #39

Merged
merged 5 commits into from
Jul 28, 2016
Merged

Addon author guide #39

merged 5 commits into from
Jul 28, 2016

Conversation

tomdale
Copy link
Collaborator

@tomdale tomdale commented Jul 27, 2016

No description provided.

changes to ensure that your addon runs correctly in the FastBoot
environment.

Remember that when updating your addons for FastBoot compatibility,

Choose a reason for hiding this comment

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

Adding similar language to the README (and site) for app developers. This is the most common class of errors everyone will encounter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arjansingh I was going to extract some of the material here to an "App Upgrade Guide," which shares a lot of material, but there is some addon-specific stuff I don't want to overwhelm people.

@arjansingh
Copy link

arjansingh commented Jul 27, 2016

@tomdale honestly with the exception of the last sections this stuff is applicable to App as well as Addon developers. I'd consider making this just a plain developer guide.

Edit: And generally I like it.

environment.

Remember that when updating your addons for FastBoot compatibility,
your code now must run in both a browser *and* Node.js. Most
Copy link
Contributor

Choose a reason for hiding this comment

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

"your code now must run" -> "your code must now run" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@locks I think both are correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

your ordering sounds weird to my ear for some reason, not a grammatical nitpick

@davidpett
Copy link
Contributor

Only question I have: is the getOwner method preferred to checking the global FastBoot variable?

### Tracking It Down

FastBoot works by turning an Ember application and all of its
dependencies (including your addon) into a single bundle of JavaScript.
Copy link
Contributor

@locks locks Jul 27, 2016

Choose a reason for hiding this comment

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

I'm being overly precious here, but what do you think about emdashes instead of parens here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For me, em dashes denote an abrupt change of thought, or an interjection. Parentheses denote an explanatory or clarifying remark.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But commas may be more appropriate here.

@tomdale
Copy link
Collaborator Author

tomdale commented Jul 28, 2016

@davidpett I'm hoping to RFC an "optional injection" feature to Ember.js, in which case we can update that section and the only that that changes is the PR, not the code that consumes it. And you still need to look up the owner to get the service.

@rwjblue
Copy link
Member

rwjblue commented Jul 28, 2016

This looks good to me, and reads well. Thanks @tomdale!

if (!process.env.EMBER_CLI_FASTBOOT) {
// This will only be included in the browser build
app.import('some/jquery.plugin.js')
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It may seem obvious, but it's easy to miss if you're just swatting at a "don't break the build" problem -- this means that jquery.plugin.js is not available in your app, and it's worth doing a quick check to ensure this is handled gracefully.

For example, if you're importing d3, and use in helpers for number formatting or something -- the d3 module will now be undefined. The consequence will be that the fastboot-generated HTML will either be incorrect, or incomplete.

@tomdale tomdale merged commit bbae26d into master Jul 28, 2016
@tomdale tomdale deleted the addon-author-guide branch July 28, 2016 18:02
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.

7 participants