title: Grails: How do I use the resources plugin to add a CSS "link" tag into the head?
body: <p>I have a page that uses quite a lot of include files. It dynamically selects the correct include file to use. I'd like to (in the include file) be able to specify to grails that I'd like it to include a specific <code>&lt;link rel="stylesheet"/&gt;</code> tag into the head, on the fly.</p>
  
  <p>Something <em>output</em> like this..</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;My Life :: My Pets&lt;/title&gt;
      &lt;link rel="stylesheet" href="style.css" type="text/css"&gt; &lt;!-- Normal Site Style --&gt;
      &lt;link rel="stylesheet" href="include-my-pets" type="text/css"&gt; &lt;!-- Dynamic Style for Include --&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;My Pets&lt;/h1&gt;
      &lt;!-- This is the include file start --&gt;
         In the GSP here I said something like:
         &lt;r:require disposition="head"&gt;
           &lt;link rel="stylesheet" href="include-my-pets" type="text/css"&gt; &lt;!-- Dynamic Style --&gt;
         &lt;/r:require&gt;
         to get the CSS link tag pushed into the head.
      &lt;!-- This is the include file end --&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This has worked very well for me using the <code>&lt;r:script/&gt;</code> tag. I can specify anywhere in any include file:</p>
  
  <pre><code>&lt;r:script disposition="head"&gt;
    alert ('hello')
  &lt;/r:script&gt;
  </code></pre>
  
  <p>And my layout automatically gets the alert hello stuck inside a <code>&lt;script/&gt;</code> tag in the head of the page. It is also removed from the body.</p>