-
Notifications
You must be signed in to change notification settings - Fork 2k
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 header with version number to compiled JS #1778
Comments
As @josh mentions in the other thread -- we've discussed this before ... but I think that Trevor's approach here is very nice and non-invasive. You won't see it littering up small examples too much. But. What about folks who are piping into files?
... or whatever. |
+1 |
I think it's acceptable for the only options with the command-line |
You've got that right. |
I really like this idea, for maintainability in particular. |
What about javascript files that are built with CoffeeScript compilation as just part of a larger build process? For example, would you then have the build process for extras/coffee-script.js put this comment at the top of the file manually? |
@misfo The option would be available as a flag, just as
|
@TrevorBurnham That makes sense. But this won't help github recognize that extras/coffee-script.js was compiled (mostly) from CoffeeScript, since uglifiy will have removed any of those comments. So will that same comment get added back into the built JS file by the build process? |
@misfo: Minified JS is recognised separately from generated JS. I believe they recognise the fact that the average line length is very long. So there's no need for an identifying comment in minified output. |
@misfo we detect minified js separately: https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb#L246-255 |
+1 Not commenting on all the details of the thread, but +1 on the concept. |
Pull request is at #1793. Have at it. By the way, while testing this I noticed that on the current master, every
gets compiled to
Note sure what caused this, but I'm assuming it wasn't intentional... [Edit: Ah, apparently it was. The relevant commit is d2b0404, and there was some discussion at #1713.] |
Closing this ticket in favor of continuing the conversation over on the pull request ... (aside: Shouldn't there be some way of creating a pull request that joins an existing ticket? Most of our conversations end up splitting into two or more parts because of pull requests.) |
Adding header to generated JS (#1778)
It would be nice if
.js
files compiled from CoffeeScript started with a simple comment likeThere would be three major advantages to this:
That last reason is, in my view, the big one. It's great that CoffeeScript has been stable for the last several months (hurray, my book isn't obsolete yet!), but it'd be nice to make some breaking changes in the future, and most CoffeeScript projects aren't documenting the version of CoffeeScript they're being compiled with.
As to the precise implementation:
CoffeeScript.compile
should accept aheader
flag, which would be set totrue
when the compiler is invoked fromcommand.coffee
to generate a JS file. That way, it wouldn't show up in cases likecoffee -pe "foo()"
or in environments like Try CoffeeScript. Sound good?The text was updated successfully, but these errors were encountered: