Hybris HAC - 如何根据环境改变背景颜色?

时间:2018-03-12 15:28:55

标签: hybris

我有几台服务器。 每个人都安装了Hybris,我希望能够根据我所处的环境选择HAC的背景颜色。

示例:

  • 开发环境=蓝色
  • 测试环境=绿色
  • 生产环境= RED颜色

我怎样才能做到这一点?

2 个答案:

答案 0 :(得分:2)

有可能,但您必须修改hybris\bin\platform\ext\hac\web\webroot\static\css\style.css文件中的某些行。

你应该:

  • 找到body.logincontainer选择器并注释掉行:

    background-color: #162c5e;
    background: -moz-linear-gradient(top, #1d346b, #162c5f) #162c5e;
    background: -ms-linear-gradient(top, #1d346b, #162c5f) #162c5e;
    background: -o-linear-gradient(top, #1d346b, #162c5f) #162c5e;
    background: -webkit-gradient(linear, center top, center bottom, from(#1d346b), to(#162c5f) ) #162c5e;
    background: -webkit-linear-gradient(top, #1d346b, #162c5f) #162c5e;
    background: linear-gradient(top, #1d346b, #162c5f) #162c5e;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#1d346b, endColorstr=#162c5f);               
    -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#1d346b, endColorstr#162c5f);
    
  • body.logincontainer添加到以下行:

    background-color: red;
    
  • 找到body选择器并注释掉行:

    background: url("../img/bodyBG.gif") repeat-x scroll 0 0 #4B5367;
    
  • body选择器中添加以下行:

    background-color: red;
    

然后HAC将如下所示:

HAC login HAC application

答案 1 :(得分:2)

如果您想自动执行此操作,请为每个安装项目的开发人员或/和每个环境中的每个部署执行此操作:

  1. deployment/cmdb文件夹中的application.properties文件夹中,您必须为不同的环境添加此文件:

    • DEV环境:无需更改此环境,只需使用默认模板

    • TEST环境#custom hac/backoffice css

        

      xxx.backoffice.extracss = body {background:#006600 none!important;}   xxx.hac.extracss = body {background:#006600 none!important;}

    • PROD环境: #custom hac/backoffice css

        

      xxx.backoffice.extracss = body {background:#660000 none!important;}   xxx.hac.extracss = body {background:#660000 none!important;}

      1. src/hybris/bin/custom/xxx/xxxcore/buildcallbacks.xml中,转到应答器<macrodef name="xxx_before_build">并添加:

          <if>
            <isset property="xxx.backoffice.extracss"/>
            <then>
              <echo message="Customizing hmc css with ${xxx.backoffice.extracss}"/>
              <echo file="${HYBRIS_BIN_DIR}/custom/xxx/xxxcore/hmc/jsp/ext/xxxcore/css/xxxcore.css">${xxx.backoffice.extracss}</echo>
            </then>
            <else>
              <echo file="${HYBRIS_BIN_DIR}/custom/xxx/xxxcore/hmc/jsp/ext/xxxcore/css/xxxcore.css"/>
            </else>
          </if>
          <if>
            <isset property="xxx.hac.extracss"/>
            <then>
              <echo message="Customizing hac css with ${xxx.hac.extracss}"/>
              <echo file="${HYBRIS_BIN_DIR}/platform/ext/hac/web/webroot/static/css/xxxcore.css">${xxx.hac.extracss}</echo>
            </then>
            <else>
              <echo file="${HYBRIS_BIN_DIR}/platform/ext/hac/web/webroot/static/css/xxxcore.css"/>
            </else>
          </if>
        
      2. src/hybris/bin/ext-platform-optional/hmc/web/webroot/css/hmc.css添加:

          

        / ===开始扩展:xxxcore文件:xxxcore.css === /

             

        body {background: #333333 none !important;}

  2. platform/ext/hac/web/webroot/static/css/style.css添加:

      

    @IMPORT url(&#34; xxxcore.css&#34;);

  3. src/hybris/config/customize/platform/ext/hac/web/webroot/static/css/style.css添加:

      

    @IMPORT url(&#34; xxxcore.css&#34;);

  4. 注意:请忘记通过您的姓名扩展来取代 xxx!