Answers.Body: <p>Environment variables don't exist in Craft 3 in the same way that they existed in Craft 2. Instead, they have been replaced with system environment variables and aliases.</p>
  
  <p>The <a href="https://docs.craftcms.com/v3/changes-in-craft-3.html#config-settings" rel="nofollow noreferrer">Changes in Craft 3</a> docs explain what changes have been made and the <a href="https://docs.craftcms.com/v3/config/environments.html" rel="nofollow noreferrer">Environmental Configuration</a> explains how you can set these up and use them.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-27T16:54:46.043Z
Answers.LastActivityDate: 2020-01-27T16:54:46.043Z
Answers.UserDisplayName: Steve Rowling
Body: <p>In my Craft 2 install, I had many links in Twig templates like this:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="{{ craft.config.environmentVariables.baseUrl }}assets/css/styles.css"&gt;
  </code></pre>
  
  <p>I recently upgraded to Craft 3, and on my local environment, these links no longer work. I get this error:</p>
  
  <pre><code>Neither the property "environmentVariables" nor one of the methods "environmentVariables()", "getenvironmentVariables()"/"isenvironmentVariables()"/"hasenvironmentVariables()" or "__call()" exist and have public access in class "craft\web\twig\variables\Config".
  </code></pre>
  
  <p>Is there a new way of using environment variables (or whatever they are now called) in Craft 3? I'm just trying to set links to the site URL, but I'd like to have that be different for my local development site and the production site. I found some documentation on how to use environment variables in Control Panel settings, but nothing about Twig templates.</p>
  
Tags: <templating><craft3><craft2><environmentvariables>
Title: Just upgraded to Craft 3, environmentVariables changed or stopped working
ThreadText: # Just upgraded to Craft 3, environmentVariables changed or stopped working
  
  (Asked by: username_0 on 2020-01-26)
  
  In my Craft 2 install, I had many links in Twig templates like this:
  
  ```
  <link rel="stylesheet" href="{{ craft.config.environmentVariables.baseUrl }}assets/css/styles.css">
  
  ```
  
  I recently upgraded to Craft 3, and on my local environment, these links no longer work. I get this error:
  
  ```
  Neither the property "environmentVariables" nor one of the methods "environmentVariables()", "getenvironmentVariables()"/"isenvironmentVariables()"/"hasenvironmentVariables()" or "__call()" exist and have public access in class "craft\web\twig\variables\Config".
  
  ```
  
  Is there a new way of using environment variables (or whatever they are now called) in Craft 3? I'm just trying to set links to the site URL, but I'd like to have that be different for my local development site and the production site. I found some documentation on how to use environment variables in Control Panel settings, but nothing about Twig templates.
  
  **Tags:** templating, craft3, craft2, environmentvariables
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-01-27. Score: 4
  
  Environment variables don't exist in Craft 3 in the same way that they existed in Craft 2. Instead, they have been replaced with system environment variables and aliases.
  
  The [Changes in Craft 3](https://docs.craftcms.com/v3/changes-in-craft-3.html#config-settings) docs explain what changes have been made and the [Environmental Configuration](https://docs.craftcms.com/v3/config/environments.html) explains how you can set these up and use them.
  
  
  ---
  
  