D3.js

d3js.org

Official Implementation

HTML<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>

Solution

Remove any script tags you may have in the head and add the following coffeescript to your application:

COFFEESCRIPTdo_d3_stuff = (data) ->
  ...

$ ->
  $(document).on 'ready page:load', ->
      $.getScript "//cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js", ->
        d3.json '/yourdata.json', (error, json) ->
          return console.warn(error) if error
          do_d3_stuff(json)

This is known to work in practice in production, however it may not be totally optimal. If you use a more advanced implementation of D3, and you find this solution isn't working well, let me know.

Related Issues: #43

Credit: Carlos Puchol


All solutions should be considered unofficial. There is no guarantee that a given solution will work with your application. If you find that a solution is insufficient, please let me know by submitting an issue on Github.