Answers.Body: <p>If you are using Craft 3 Multi-Environment then you can add environment specific aliases to those assets in your <a href="https://github.com/nystudio107/craft3-multi-environment/blob/master/config/general.php" rel="nofollow noreferrer">general config file</a>.</p>
  
  <p>Eg: </p>
  
  <pre><code>// Live (production) environment
  'live' =&gt; [
      // Craft defined config settings
      'allowUpdates' =&gt; false,
      'backupOnUpdate' =&gt; false,
      'devMode' =&gt; false,
      'enableTemplateCaching' =&gt; true,
      'isSystemOn' =&gt; true,
      // Aliases parsed in sites’ settings, volumes’ settings, and Local 
      volumes’ settings
      'aliases' =&gt; [
        '@assetPath' =&gt; '/dist/'
      ],
      // Custom site-specific config settings
      'custom' =&gt; [
  
      ]
  ],
  </code></pre>
  
  <p>Then, in your templates you can use <code>{{ alias('@assetPath/js/' }}</code>.</p>
  
  <p>Note, while I've called the alias assetPath, you can name it anything you like.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-14T16:26:48.400Z
Answers.Text: thanks @Seth, yeah I am already using this multi config file, so this should be easy to implement. Although I haven't time to give it a try, I check this answer :-) If I encounter any problems I will comment again, but this seems pretty straightforward! :-)
Answers.UserDisplayName: Pascal G.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-13T13:15:01.610Z
Answers.LastActivityDate: 2018-02-13T13:15:01.610Z
Answers.UserDisplayName: Seth Warburton
Body: <p>How do you guys handle different paths between local and production environments regarding css and js files in your template twig files?</p>
  
  <p>I am following the tutorials of nystudio107, which are simply awesome but can't see how this is be solved even in his pre-ready and configured craft3 download packages.</p>
  
  <p>For example, in local dev I'd like to keep the css and js files separated from each other and unminified for better debugging. On production the files are combined and minified with gulp and moved to a /dist/css – /dist/js folder, which then does not matches the layout path I set in the twig files. Do you ran into similar problems and use a performant solution or do you hardcode the paths to the files on production environment?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-12T18:55:51.810Z
Comments.Text: Do you really use Craft 3? If so you can create different assetBundes for different environments. I can explain how after I know if it's Craft 3 or Craft 2. http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#defining-asset-bundles Just check your environment and load different sources
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-12T21:56:18.397Z
Comments.Text: Hello @RobinSchambach , yes I moved on to Craft 3.0.0.RC9. I am very new to all sort of dev environments. Before that I modified wordpress themes directly within a child theme over ftp. So I am sorry, if my question is really newbie! Thanks for the help in advance
Comments.UserDisplayName: Pascal G.
Tags: <assets><deployment>
Title: Handling path to assets (css, js) between local and production environment
ThreadText: # Handling path to assets (css, js) between local and production environment
  
  (Asked by: username_0 on 2018-02-12)
  
  How do you guys handle different paths between local and production environments regarding css and js files in your template twig files?
  
  I am following the tutorials of nystudio107, which are simply awesome but can't see how this is be solved even in his pre-ready and configured craft3 download packages.
  
  For example, in local dev I'd like to keep the css and js files separated from each other and unminified for better debugging. On production the files are combined and minified with gulp and moved to a /dist/css – /dist/js folder, which then does not matches the layout path I set in the twig files. Do you ran into similar problems and use a performant solution or do you hardcode the paths to the files on production environment?
  
  **Tags:** assets, deployment
  
  > **Comments:**
  > **username_1**: Do you really use Craft 3? If so you can create different assetBundes for different environments. I can explain how after I know if it's Craft 3 or Craft 2. http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#defining-asset-bundles Just check your environment and load different sources  
  > **username_0**: Hello @username_1 , yes I moved on to Craft 3.0.0.RC9. I am very new to all sort of dev environments. Before that I modified wordpress themes directly within a child theme over ftp. So I am sorry, if my question is really newbie! Thanks for the help in advance  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-02-13. Score: 1 | Accepted answer
  
  If you are using Craft 3 Multi-Environment then you can add environment specific aliases to those assets in your [general config file](https://github.com/nystudio107/craft3-multi-environment/blob/master/config/general.php).
  
  Eg:
  
  ```
  // Live (production) environment
  'live' => [
      // Craft defined config settings
      'allowUpdates' => false,
      'backupOnUpdate' => false,
      'devMode' => false,
      'enableTemplateCaching' => true,
      'isSystemOn' => true,
      // Aliases parsed in sites’ settings, volumes’ settings, and Local 
      volumes’ settings
      'aliases' => [
        '@assetPath' => '/dist/'
      ],
      // Custom site-specific config settings
      'custom' => [
  
      ]
  ],
  
  ```
  
  Then, in your templates you can use `{{ alias('@assetPath/js/' }}`.
  
  Note, while I've called the alias assetPath, you can name it anything you like.
  
  > **Comments:**
  > **username_0**: thanks @username_2, yeah I am already using this multi config file, so this should be easy to implement. Although I haven't time to give it a try, I check this answer :-) If I encounter any problems I will comment again, but this seems pretty straightforward! :-)  
  
  ---
  
  