Answers.Body: <p>those CP files are included by <a href="https://github.com/craftcms/cms/blob/fdfda241b463b4df2d81ef20ed411ca65599e4e7/src/web/assets/cp/CpAsset.php#L52" rel="nofollow noreferrer">CpAsset</a> asset bundle.</p>
  
  <p>if your plugin asset bundle depends on CpAsset:</p>
  
  <pre><code>class YourPluginAsset extends AssetBundle
  {
      public function init()
      {
          $this-&gt;sourcePath = __DIR__ . '/dist';
          $this-&gt;depends = [
           CpAsset::class,
          ]
       //....
      }
  }
  </code></pre>
  
  <p>and if you register your plugin asset in frontend or backend template:</p>
  
  <pre><code>{% do view.registerAssetBundle("ns\\prefix\\YourPluginAsset") %}
  </code></pre>
  
  <p>or via controller:</p>
  
  <pre><code> $this-&gt;view-&gt;registerAssetBundle(YourPluginAsset::class);
  </code></pre>
  
  <p>those file are added to that page automatically.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T22:43:12.627Z
Answers.Text: Thank you. Very helpful!
Answers.UserDisplayName: kr37
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T10:42:33.850Z
Answers.LastActivityDate: 2020-05-16T10:57:50.973Z
Answers.LastEditDate: 2020-05-16T10:57:50.973Z
Answers.UserDisplayName: user9975
Body: <p>Perhaps in some way related to <a href="https://craftcms.stackexchange.com/questions/28878/updating-matrix-field-from-font-end-with-entry-setfieldvalue-pulls-in-cp-bun">this</a>, I've got a couple of front-end pages on our website that pull in the following files, which seem to all be CP files. These two pages each utilize plugins I've written, each one a different plugin, so there must be something I'm doing in my plugins that calls this stuff in. Any hints?</p>
  
  <pre><code>selectize.css
  craft.css
  charts.css 
  axios.min.js
  d3.js
  element-resize-detector.js
  jquery.js
  jquery.mobile-events.min.js
  velocity.js
  garnish.js
  jquery-ui.min.js
  jquery.payment.js
  picturefill.js
  selectize.js
  jquery.fileupload.js
  xregexp-all.js
  fabric.js
  Craft.min.js
  </code></pre>
  
  <p><strong>EDIT:</strong> Here is the relevant asset-bundle:</p>
  
  <pre><code>class LivestreamAsset extends AssetBundle
  {
      // Public Methods
      // =========================================================================
  
      /**
       * Initializes the bundle.
       */
      public function init()
      {
          // define the path that your publishable resources live
          $this-&gt;sourcePath = "@kr37/livestream/assetbundles/livestream/dist";
  
          // define the dependencies
          $this-&gt;depends = [
              CpAsset::class,
          ];
  
          // define the relative path to CSS/JS files that should be registered with the page
          // when this asset bundle is registered
          $this-&gt;js = [
              'js/Livestream.js',
          ];
  
          $this-&gt;css = [
              'css/Livestream.css',
          ];
  
          parent::init();
      }
  }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-15T13:58:48.787Z
Comments.Text: are your plugin assets depending on CpAsset? those files are included in page by CpAsset. - look for YourPluginAsset file in src/assets folder of your plugin and check $this->depend=[CpAsset::class]; also you are probably registering YourPluginAsset class in your front end template.
Comments.UserDisplayName: user9975
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-15T20:50:50.700Z
Comments.Text: You nailed it. I was re-purposing an assetbundle created by pluginfactory.io, and didn't notice that in there. Removing that fixes the problem. If you write it up as an answer, I'll accept it. (Also I edited my question to include the offending lines.)
Comments.UserDisplayName: kr37
Tags: <craft3><control-panel><frontend>
Title: What is causing Craft CP assets(JS/CSS) to appear in front-end pages?
ThreadText: # What is causing Craft CP assets(JS/CSS) to appear in front-end pages?
  
  (Asked by: username_0 on 2020-05-14)
  
  Perhaps in some way related to [this](https://craftcms.stackexchange.com/questions/28878/updating-matrix-field-from-font-end-with-entry-setfieldvalue-pulls-in-cp-bun), I've got a couple of front-end pages on our website that pull in the following files, which seem to all be CP files. These two pages each utilize plugins I've written, each one a different plugin, so there must be something I'm doing in my plugins that calls this stuff in. Any hints?
  
  ```
  selectize.css
  craft.css
  charts.css 
  axios.min.js
  d3.js
  element-resize-detector.js
  jquery.js
  jquery.mobile-events.min.js
  velocity.js
  garnish.js
  jquery-ui.min.js
  jquery.payment.js
  picturefill.js
  selectize.js
  jquery.fileupload.js
  xregexp-all.js
  fabric.js
  Craft.min.js
  
  ```
  
  **EDIT:** Here is the relevant asset-bundle:
  
  ```
  class LivestreamAsset extends AssetBundle
  {
      // Public Methods
      // =========================================================================
  
      /**
       * Initializes the bundle.
       */
      public function init()
      {
          // define the path that your publishable resources live
          $this->sourcePath = "@username_0/livestream/assetbundles/livestream/dist";
  
          // define the dependencies
          $this->depends = [
              CpAsset::class,
          ];
  
          // define the relative path to CSS/JS files that should be registered with the page
          // when this asset bundle is registered
          $this->js = [
              'js/Livestream.js',
          ];
  
          $this->css = [
              'css/Livestream.css',
          ];
  
          parent::init();
      }
  }
  
  ```
  
  **Tags:** craft3, control-panel, frontend
  
  > **Comments:**
  > **username_1**: are your plugin assets depending on CpAsset? those files are included in page by CpAsset. - look for YourPluginAsset file in src/assets folder of your plugin and check $this->depend=[CpAsset::class]; also you are probably registering YourPluginAsset class in your front end template.  
  > **username_0**: You nailed it. I was re-purposing an assetbundle created by pluginfactory.io, and didn't notice that in there. Removing that fixes the problem. If you write it up as an answer, I'll accept it. (Also I edited my question to include the offending lines.)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-16. Score: 3 | Accepted answer
  
  those CP files are included by [CpAsset](https://github.com/craftcms/cms/blob/fdfda241b463b4df2d81ef20ed411ca65599e4e7/src/web/assets/cp/CpAsset.php#L52) asset bundle.
  
  if your plugin asset bundle depends on CpAsset:
  
  ```
  class YourPluginAsset extends AssetBundle
  {
      public function init()
      {
          $this->sourcePath = __DIR__ . '/dist';
          $this->depends = [
           CpAsset::class,
          ]
       //....
      }
  }
  
  ```
  
  and if you register your plugin asset in frontend or backend template:
  
  ```
  {% do view.registerAssetBundle("ns\\prefix\\YourPluginAsset") %}
  
  ```
  
  or via controller:
  
  ```
   $this->view->registerAssetBundle(YourPluginAsset::class);
  
  ```
  
  those file are added to that page automatically.
  
  > **Comments:**
  > **username_0**: Thank you. Very helpful!  
  
  ---
  
  