Search code examples
sproutcore-2typekit

How do I load javascript from external source in a Sproutcore application?


I want to use typekit in a sproutcore app, which means I should add following javascript to my mainpage tag:

<script type="text/javascript" src="http://use.typekit.com/jfg6pfv.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>

How do I do this in sproutcore?


Solution

  • Create a file named "resources/page_javascript.rhtml":

    <% content_for("page_javascript") do %>
      <script type="text/javascript" src="http://use.typekit.com/jfg6pfv.js"></script>
      <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
    <% end %>