rmrevin / yii2-minify-view

Yii2 View component with minification css & js
MIT License
191 stars 67 forks source link

invalid asset file path #1

Closed nsanden closed 9 years ago

nsanden commented 10 years ago

PHP Warning – yii\base\ErrorException

sha1_file(/home/wordcoun/public_html/new/advanced/frontend/web/new/advanced/frontend/web/assets/8604a1d6/css/bootstrap.css): failed to open stream: No such file or directory

It's duplicating the /new/advanced/frontend/web/ part of the path

rmrevin commented 10 years ago

Show the code of connection assets

nsanden commented 10 years ago

Which code do you want? It could just be that i'm not setting up my configuration properly. (I'm very new to Yii2)

It's working now after changing:

        'view' => [
            'class' => '\rmrevin\yii\minify\View',
            'base_path' => '@app/web', // path to web base,
            'minify_path' => '@app/web/minify', // path to save minify result
        ],

to:

        'view' => [
            'class' => '\rmrevin\yii\minify\View',
            'base_path' => $_SERVER['DOCUMENT_ROOT'], // path to web base,
            'minify_path' => '@app/web/minify', // path to save minify result
        ],
nsanden commented 10 years ago

Here's code I think you wanted:

<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace frontend\assets;

use yii\web\AssetBundle;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/custom.css',
    ];
    public $js = [
        'js/jquery.cookie.js',
        'js/jquery.density.js',
        'js/jquery.highlight.js',
        'js/jquery.textarearesizer.compressed.js',
        'js/garlic.js',
        'js/custom.js',
    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
        'yii\bootstrap\BootstrapPluginAsset',
        'yii\web\JqueryAsset',
    ];
}
rmrevin commented 10 years ago

Show your

echo Yii::getAlias('@app/web');
nsanden commented 10 years ago

Here is the output: /home/wordcoun/public_html/new/advanced/frontend/web

My entry script is at /home/wordcoun/public_html/index.php

rmrevin commented 9 years ago

Obsolete