title: Codeigniter HMVC asset managment
body: <p>I am trying to give a shot to HMVC in Codeigniter. Here is my folder structure.</p>
  
  <pre><code>-ROOT
  --APPLICATION
  ---MODULES
  ----Module_Email
  -----Controllers
  -----Models
  -----Views
  -----Assets
  ------JS
  ------CSS
  ------IMG
  </code></pre>
  
  <p>To render the Module i have to use</p>
  
  <pre><code>Module::run('Module_Email');
  </code></pre>
  
  <p>This method will output the rendered output, an example is given below</p>
  
  <pre><code>&lt;script type="text/javascript" src="PATH/TO/EMAIL_MODULE/JS/JS_FILE.JS"&gt;&lt;/script&gt;
  &lt;div data-module-name="Module_Email" class="Email_wrapper"&gt;
  
    //RENDERED HTML CONTENT 
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Now here my problem start. Normally i would like to put all my resources to header. So when i call any module, its dependence need to be added in header instead of from  where its get called.</p>
  
  <p>I searched a lot but i couldn't find any good methods.</p>
  
  <p>Please help.</p>
  
  <h2>Update</h2>
  
  <p>Currently i have a  function on my header called <code>get_assets()</code> which will output predefined resources to header. But i cant say which modules is going to use in pages, so the system need to check which modules are used in this page, and if its used then its dependencies need to be added on header.</p>