doukong9316 2016-01-25 16:03
浏览 40
已采纳

Symfony:加快前端开发人员的开发环境

I'm trying to create a development enviroment for the frontend developers. As long as they don't change any php code I thought it might be a good idea do this, if possible:

  1. Create a new entry point all app_frontend.php i.e., disabling the debug
  2. Create a config_frontend.yml file and cache php files generation but disable twig cache as well as js and css

Is there any way to do this? I'm not sure if it's possible

  • 写回答

1条回答 默认 最新

  • dongyong3223 2016-01-25 16:15
    关注

    You can create as many environments as you want. After all, environments are just sets of different configuration, nothing more.

    This means that if you want to create a frontend environment, you have to do just some things:

    • Create some sort of front controller that constructs AppKernel using new AppKernel('frontend', false);
    • As AppKernel::registerContainerConfiguration() in the Symfony Standard Edition uses the environment to determine the config file to load, you have to create app/config/config_frontend.yml as well (or change the logic in the AppKernel method)
    • Inside this config file, make sure you import the settings that are in common. This often means importing app/config/config.yml. Besides that, you can configure things how you like it. E.g.

      # app/config/config_frontend.yml
      imports:
          - { resource: config.yml }
      
      twig:
          cache: false
      

    You can read more about this topic in the Symfony docs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型