I
I
Ilya Beloborodov2016-12-25 04:04:43
Yii
Ilya Beloborodov, 2016-12-25 04:04:43

Why aren't resources updated?

There is this.

<?php

namespace app\modules\admin\assets;


class AdminAsset extends \yii\web\AssetBundle
{
    public $sourcePath = '@app/modules/admin/static';
    public $css = [
        'css/style.css'
    ];
    public $js = [
        'js/main.js'
    ];
    public $depends = [
        'yiister\adminlte\assets\Asset'
    ];
}

The fact is that when I edit, for example, css, so that the current version of the style would be loaded, I need to delete everything from the /web/assets folder, after that, the actual css will work. Why hasn't this happened before. tell me what's the matter

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2016-12-25
@slo_nik

Good morning. You can add it to the config file
instead

'assetManager' => [
           'linkAssets' => true,
        ],

With this setting, resource files will be immediately updated, and they will not be duplicated in web/assets, instead symbolic links to files will be created.

I
Ilya Beloborodov, 2016-12-25
@kowap

I will answer myself))

<?php

namespace app\modules\admin\assets;


class AdminAsset extends \yii\web\AssetBundle
{
    public $sourcePath = '@app/modules/admin/static';
    public $publishOptions = ['forceCopy' => true];
    public $css = [
        'css/style.css'
    ];
    public $js = [
        'js/main.js'
    ];
    public $depends = [
        'yiister\adminlte\assets\Asset'
    ];
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question