4 ms·
I dislike that this small gem is written in coffeescript. https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee https://g
by MartinMond 14y ago
I dislike that this small gem is written in coffeescript.
https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee https://github.com/rails/turbolinks/blob/master/lib/assets/j...
For various reasons we don't use coffeescript in our projects but now if we want to use turbolinks (which sounds great) we'll get a coffeescript dependency.
- sync 14y agoRails already ships with default-on coffeescript.
- MartinMond 14y agoYes, like turbolinks it's a default dependency in the Gemfile. But e.g. jquery-rails https://github.com/rails/jquery-ujs https://github.com/rails/jquery-ujs is written in JS not CS, so I can use all the jQuery integration in Rails without using CS. With turbolinks being written in CS if I want to use the full power of Rails+JS I need to add CS to my project.
- milkshakes 14y agoor, you could just compile the coffeescript into javascript once and return to your normal javascript flow
- philwelch 14y agoYou can even write your Javascript in Javascript, it should still work.
- jashkenas 14y agoPutting the ab initio strangeness of having JavaScript code in a Ruby gem aside -- what it happens to be written in shouldn't be an issue. If the gem is released with the compiled JavaScript inside of it, then it can just be used, without any additional dependency.
- MartinMond 14y agoGood point.
- rockyj 14y agoGuys hang on. When Rails assets are compiled all Coffeescript is converted to JavaScript, which is then compressed and minified. So unless you are writing any Coffescript yourselves you will never have to deal with it. Asset pre-compilation has been a Rails feature since Rails 3.1.
- jcoglan 14y agoI checked, the gem only has the Coffee source, no JavaScript. This frustrates the hell out of me -- clearly the message that you should ship JS is not getting through. When CS can do source maps, ideally people will ship the source, compiled JS and map together. Having either in a gem is rare, but sensible if the gem wants to include a client to interact with the service it provides.