-
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
Source maps: <script type="text/coffeescript"> support? #2780
Comments
Do browsers even support that? |
👍 |
@Nami-Doc That's a good question. The current v3 specification allows it by using a data uri as sourceMappingUrl and additional parameter "sourcesContent". I'm not sure about the browser support though. |
Just checked - it works in Chrome 25. |
include coffee-script.js <script type="text/javascript" src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"></script>
<script type="text/coffeescript">
console.log 'coffee'
</script> |
A little off-topic, but I've wondered this for a while... what actual use case is there for |
indeed. I suppose it may be useful for testing purposes ;). |
@kelp404 Yes, I'm aware of how to use it, thank you. The question is about supporting source maps right in the browser. |
@ashtuchkin Sorry, I got a mistake. |
@ashtuchkin How did you checked comparability? Canary seems to ignore the sourcesContent option. |
I created manually the source map, encoded original text to js string, created property sourcesContent in the source map, then base64-encoded source map and added as a sourceMapUrl to the .js file. Then viewed it in Chrome Dev Tools. Chrome 25 for Linux. |
Got it working in Canary, too. I think this is possible if we could...
I'm afraid both of them adds significant LOC to existing code base. In other hand, If we compile to js with |
Source mapping is only supported in latest Chromes & Firefox, why should we support it in IE6? Sent from my iPhone On 12.03.2013, at 20:38, Hao-kang Den [email protected] wrote:
|
Because |
I would suggest first making it optional (needs to be enabled in config hash), and then check for availability of both JSON and btoa. Imho we need not rely on user agent. This is a small feature and I agree that we should minimize impact on both cycles and file size. Sent from my iPhone On 13.03.2013, at 20:27, Hao-kang Den [email protected] wrote:
|
Just a thought. Perhaps http://yepnopejs.com/ to load https://github.com/davidchambers/Base64.js and https://github.com/douglascrockford/JSON-js. |
I wan wrong see the reply from @ashtuchkin below |
I've managed to make it work by adding sourceURL statement in addition to sourceMappingURL. Please, see https://github.com/ashtuchkin/coffee-browser-sourcemaps |
Awsome! @ashtuchkin Are you going to make a PR? I've have a working branch based on your idea. |
@hden. Want to finalize and submit your branch as a PR, if it's working? |
@hden no, feel free to submit your PR, I'll be happy to review it if needed. |
It's on master now, thanks to @hden. |
I'm not clear on this pull, is this supposed to just work with
? |
Am I missing it or there's no support for source maps when compiling coffee in browser?
The text was updated successfully, but these errors were encountered: