title: Magento2: Custom module development and DI
body: <p>I started implementation of new module in <strong>Magento2</strong> and since that time I have more questions than answers.</p>
  
  <p>I successfully created my own module and it seems to be working, but not really. I'm using my own controllers and wanted to implement my own layout, with some external (<em>not local</em>) JS/CSS files.</p>
  
  <p>What I firstly stuck with is <strong>adding some external JS/CSS to the page</strong>. It occurred to be not so easy as I thought. I've read many articles on how it could be done, but none of them worked for me. I don't want to alter any theme, I just want to use my custom page (<em>possibly without theming at all</em>).</p>
  
  <p>Furthermore I created another action (<em>same as working <code>HelloWorld</code> example</em>) in my module <code>app/code/MyModule/Product/Controller/Api/Index.php</code> which extends right class etc. etc., but again - <em>not working</em>. What I was receiving is next error:</p>
  
  <blockquote>
    <p>Recoverable Error: <strong>Argument 1</strong> passed to ...\Api\AbstractApiAction::__construct() <strong>must be an instance of</strong> Magento\Framework\App\Action\<strong>Context</strong>, instance of Magento\Framework\ObjectManager\<strong>ObjectManager given</strong>, called in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in app/code/.../Api/AbstractApiAction.php on line 24</p>
  </blockquote>
  
  <p>What was my surprise when I discovered that it will not work unless I recompile my DI container with <code>bin/magento setup:di:compile</code>. I think it is not worth saying that this process takes a bit of time. And when I'm creating new action I ought to go and do <code>setup:di:compile</code> to be able to develop on it further.</p>
  
  <p>I fully disabled caching in admin area.</p>
  
  <hr>
  
  <p>Now I want to clear several questions:</p>
  
  <ol>
  <li>How I can add external JS/CSS files to my custom page (<em>of custom controller</em>).</li>
  <li>Is there any way of developing smth. without constantly recompiling DI container? <em>Or am I missing smth.?</em></li>
  <li>According to question above, what does really <code>Developer mode</code> means in Magento2, I remember that it disables caching etc., but the codebase is not auto-regenerated or am I missing smth. again?</li>
  </ol>