This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 203
Documentation of how to use modules with CommonJS syntax or in CoffeeScript #13
Merged
lorensr
merged 12 commits into
meteor:version-NEXT
from
GeoffreyBooth:modules-commonjs-coffeescript-syntax
May 22, 2016
Merged
Documentation of how to use modules with CommonJS syntax or in CoffeeScript #13
lorensr
merged 12 commits into
meteor:version-NEXT
from
GeoffreyBooth:modules-commonjs-coffeescript-syntax
May 22, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…k from CoffeeScript package page; fixed broken link in CoffeeScript package page
Closed
|
||
You can also simply write `exports` instead of `module.exports` if you prefer. | ||
|
||
Note that [backticks](http://coffeescript.org/#embedded) do *[not](https://github.com/meteor/meteor/issues/6000)* work; your `.coffee` files will be transpiled into JavaScript, but not then handed off to the `ecmascript` package for further transpiling. Any JavaScript you type in backticks will be passed through unmodified all the way to the browser or Node.js runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that backticks do not work;
maybe "Note that putting ecmascript inside backticks does not work" ?
something to make clear from the start you're not saying they don't work period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I’ve updated that paragraph to clarify. Though it looks like there might be action on meteor/meteor#6691 soon, so hopefully I can come back and remove that paragraph entirely.
Thanks a lot! 🙌 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Okay, one last time! Moving here from meteor/meteor#6636.
This PR expands the Modules » Syntax section to include subsections for CommonJS and CoffeeScript syntax. There’s a bit of repetition between the two, since CoffeeScript is just compiling into CommonJS, but I think we should keep the duplication since I doubt most people would read the syntax section that doesn’t apply to them. I also cribbed a little from the CommonJS section of the Guide; I’m not sure what should go here versus there. If anything I think the CommonJS discussion is probably better off here, if the point of the Guide is to explain recommended practices (which obviously CommonJS is not). The caveat that the Guide points out, about how CommonJS is required (sorry, I can’t believe I just made a JavaScript pun) when importing within an
if
block, I would think is probably best explained in the docs and linked to from the Guide.Also the end of the CoffeeScript section includes a warning about backticks. If meteor/meteor#6691 is merged, we will have to remember to come back here and remove the warning.