简体   繁体   中英

Different style sheets for production and staging

I want to use different style for staging. How can i set it up differently in node environments.

For example i have the following scss files:

scss/style.scss
scss/theme.scss
scss/green.scss

after compiling its gives me

style.scss

Now i want to change the style of my staging and i want to use

**red.scss** instead of green.scss

only for staging. Production should not be effect by this.

You can set different styles on different server by adding name of style in config file.

  //require config.js and it can be like this:   

  var environments = {};        

  environments.staging = {        
      'httpPort': 3000,        
      'envName': 'staging',        
      'style': 'red.scss'
  }        

  environments.production = {        
      'httpPort': 5000,        
      'envName': 'production',        
      'style': 'green.scss'        
  }        

  var currentEnvironment = typeof(process.env.NODE_ENV) == 'string' ? process.env.NODE_ENV : '';        
  var environmentToExport = typeof(environments[currentEnvironment]) == 'object' ? environments[currentEnvironment] : environments.staging;        

  module.exports = environmentToExport;        

您是否考虑过使用环境变量?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM