title: Including Trianglify in Ruby on Rails
body: <p>I am trying to make a background using trianglify. To do this I must include it in my project and use it properly. The thing I am trying to achieve is making a background like trianglify is supposed to.</p>
  
  <p>here is my application.html.erb</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;&lt;%= full_title(yield(:title)) %&gt;&lt;/title&gt;
      &lt;%= stylesheet_link_tag "application", media: "all",
                                             "data-turbolinks-track" =&gt; true %&gt;
      &lt;%= javascript_include_tag "application", "data-turbolinks-track" =&gt; true %&gt;
      &lt;%= csrf_meta_tags %&gt;
  
  
  
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;%= render 'layouts/header' %&gt;
      &lt;div class="container"&gt;
       &lt;div class="row"&gt;
        &lt;% flash.each do |message_type, message| %&gt;
          &lt;div class="alert alert-&lt;%= message_type %&gt;"&gt;&lt;%= message %&gt;&lt;/div&gt;
        &lt;% end %&gt;
        &lt;%= yield %&gt;
       &lt;/div&gt;
        &lt;%= render 'layouts/footer' %&gt;
        &lt;%= debug(params) if Rails.env.development? %&gt;
      &lt;/div&gt;
  
    &lt;/body&gt;
  
  
  
  &lt;/html&gt;
  
  
  &lt;script&gt;
      var Trianglify = require([]);
      var pattern = Trianglify({
          width: window.innerWidth, 
          height: window.innerHeight
      });
      document.body.appendChild(pattern.canvas())
  &lt;/script&gt; 
  </code></pre>
  
  <p>Obviously it didn't put a background image . I checked with inspector and I get </p>
  
  <pre><code>    ReferenceError: require is not defined trianglify.js:8:4
  ReferenceError: require is not defined localhost:3000:32:8
  </code></pre>
  
  <p>I guess it doesn't import something or I did something wrong?</p>
  
  <p>To solve this error I downloaded <a href="http://requirejs.org/docs/release/2.1.17/comments/require.js" rel="nofollow">http://requirejs.org/docs/release/2.1.17/comments/require.js</a> and now i get another error namely:</p>
  
  <pre><code>Error: Module name "delaunay-fast" has not been loaded yet for context: _. Use require([])
  http://requirejs.org/docs/errors.html#notloaded require.js:167:16
  Error: Module name "trianglify" has not been loaded yet for context: _. Use require([])
  http://requirejs.org/docs/errors.html#notloaded
  </code></pre>