title: Loading core scripts such as jQuery in Yii 2
body: <p>I've been having a hard time trying to figure out how to load <code>jQuery</code> or other CORE scripts in <code>Yii 2</code>.</p>
  
  <p>In <code>Yii 1</code> it seemed this was the way:</p>
  
  <pre><code>&lt;?php Yii::app()-&gt;clientScript-&gt;registerCoreScript("jquery"); ?&gt;
  </code></pre>
  
  <p>In Yii 2, $app is a property of Yii, not a method, so the above naturally doesn't work, but changing it to:</p>
  
  <pre><code>&lt;?php Yii::$app-&gt;clientScript-&gt;registerCoreScript("jquery"); ?&gt;
  </code></pre>
  
  <p>produces this error:</p>
  
  <pre><code>Getting unknown property: yii\web\Application::clientScript
  </code></pre>
  
  <p>I couldn't find any documentation for Yii 2 about loading core scripts, so I tried the below:</p>
  
  <pre><code>&lt;?php $this-&gt;registerJsFile(Yii::$app-&gt;request-&gt;baseUrl . '/js/jquery.min.js', array('position' =&gt; $this::POS_HEAD), 'jquery'); ?&gt;
  </code></pre>
  
  <p>Whilst this loads jQuery in the head, a second version of jQuery is also loaded by Yii <em>when needed</em> and hence causes conflict errors.</p>
  
  <p>Additionally, I don't want to use Yii's implementation of jQuery, I would prefer to maintain my own and hence that is why I am doing this.</p>
  
  <p>How can I load jQuery and other core files without Yii loading duplicate copies of them when it needs them? </p>