Php 如何在OctoberCMS开发中禁用资产组合

Php 如何在OctoberCMS开发中禁用资产组合,php,octobercms,Php,Octobercms,十月CMS提供方便的功能来组合js/css资产。在我的layouts/default.htm中,我有这样定义的脚本: <script src="{{ [ 'assets/javascript/jquery.js', 'assets/vendor/bootstrap/js/transition.js', 'assets/vendor/bootstrap/js/alert.js', 'assets/vendor/bootstrap/js/button.js',

十月CMS提供方便的功能来组合js/css资产。在我的
layouts/default.htm
中,我有这样定义的脚本:

<script src="{{ [
    'assets/javascript/jquery.js',
    'assets/vendor/bootstrap/js/transition.js',
    'assets/vendor/bootstrap/js/alert.js',
    'assets/vendor/bootstrap/js/button.js',
    'assets/vendor/bootstrap/js/carousel.js',
    'assets/vendor/bootstrap/js/collapse.js',
    'assets/vendor/bootstrap/js/dropdown.js',
    'assets/vendor/bootstrap/js/modal.js',
    'assets/vendor/bootstrap/js/tooltip.js',
    'assets/vendor/bootstrap/js/popover.js',
    'assets/vendor/bootstrap/js/scrollspy.js',
    'assets/vendor/bootstrap/js/tab.js',
    'assets/vendor/bootstrap/js/affix.js',
    'assets/javascript/app.js',
    '@framework',
    '@framework.extras'
]|theme }}"></script>
{% scripts %}
config/app.php
中:

'debug' => true,
这将导致合并在细枝数组中定义的所有脚本。在呈现的网站上,我得到一个javascript文件

<script src="http://localhost/Test/october/combine/2cdc17b704821cd2ffbd9be8e4d340f9-1457016128"></script>
我在github上发现了这个1.5年的问题,但没有有用的答案:

文件也没有说明这件事的任何有用之处:


你知道怎么处理这件事吗?我想也许我可以在OctoberCMS中创建一个插件,它将根据配置设置(debug true/false)向布局注入资产。但据我所知,从插件内部注入资产,需要将资产放在插件目录中,而不是主题目录中好的,我设法解决了这个问题,但没有使用问题中提到的
配置/app.php

其他解决方案需要在OctoberCMS的根目录中创建
.env
文件。默认情况下,此文件位于
.gitignore
中,因此您可以在生产和开发中使用不同的.env文件()

此文件的内容应为:

APP_ENV=dev
然后可以访问细枝中的变量:

{% if this.environment == 'dev' %}
    <script src="{{ 'assets/vendor/jquery.min.js'|theme }}"></script>
    <script src="{{ 'assets/semantic/dist/semantic.min.js'|theme }}"></script>
    <script src="{{ 'assets/javascript/app.js' | theme }}"></script>
    {% framework extras %}
{% else %}
    <script src="{{ [
     'assets/vendor/jquery.js',
     'assets/semantic/dist/semantic.js',
     'assets/javascript/app.js',
     '@framework',
     '@framework.extras'
     ]|theme }}"></script>
{% endif %}
{%if this.environment=='dev%}
{%framework extras%}
{%else%}
{%endif%}

尝试在您的配置文件(app/config/cms.php)中关闭


op要求禁用合路器,而不是缩小
APP_ENV=dev
{% if this.environment == 'dev' %}
    <script src="{{ 'assets/vendor/jquery.min.js'|theme }}"></script>
    <script src="{{ 'assets/semantic/dist/semantic.min.js'|theme }}"></script>
    <script src="{{ 'assets/javascript/app.js' | theme }}"></script>
    {% framework extras %}
{% else %}
    <script src="{{ [
     'assets/vendor/jquery.js',
     'assets/semantic/dist/semantic.js',
     'assets/javascript/app.js',
     '@framework',
     '@framework.extras'
     ]|theme }}"></script>
{% endif %}
/*
|--------------------------------------------------------------------------
| Determines if the asset minifcation is enabled.
|--------------------------------------------------------------------------
|
| If the minifcation is enabled, combined assets are compressed (minified).
| It is recommended to disable the minification during the development, and
| enable it in the production mode.
|
*/

'enableAssetMinify' => true,