rmrevin / yii2-minify-view

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

Path incorrect in Advanced Template #13

Closed adiramardiani closed 9 years ago

adiramardiani commented 9 years ago

I use advanced application template with separate in backend and frontend, but give error file_get_contents(C:\xampp\htdocs\dashboard/backend/web/dashboard/admin/assets/3b75345a/css/bootstrap.css): failed to open stream: No such file or directory

'view' => [
            'class' => '\rmrevin\yii\minify\View',
            'enableMinify' => true,
            'base_path' => '@backend/web', // path alias to web base
            'minify_path' => '@backend/web/minify', // path alias to save minify result
            'js_position' => [ \yii\web\View::POS_END ], // positions of js files to be minified
            'force_charset' => 'UTF-8', // charset forcibly assign, otherwise will use all of the files found charset
            'expand_imports' => true, // whether to change @import on content
        ]

I use @app/web or @web still give the wrong output path

rmrevin commented 9 years ago

Show your aliases.

VarDumper::dump(\Yii::$aliases)
adiramardiani commented 9 years ago
["@common"]=>
  string(32) "C:\xampp\htdocs\dashboard\common"
  ["@frontend"]=>
  string(34) "C:\xampp\htdocs\dashboard/frontend"
  ["@backend"]=>
  string(33) "C:\xampp\htdocs\dashboard/backend"
  ["@console"]=>
  string(33) "C:\xampp\htdocs\dashboard/console"
  ["@app"]=>
  string(33) "C:\xampp\htdocs\dashboard\backend"
  ["@vendor"]=>
  string(40) "C:\xampp\htdocs\dashboard/../yii2/vendor"
  ["@bower"]=>
  string(46) "C:\xampp\htdocs\dashboard/../yii2/vendor\bower"
  ["@npm"]=>
  string(44) "C:\xampp\htdocs\dashboard/../yii2/vendor\npm"
  ["@runtime"]=>
  string(41) "C:\xampp\htdocs\dashboard\backend\runtime"
  ["@webroot"]=>
  string(37) "C:/xampp/htdocs/dashboard/backend/web"
  ["@web"]=>
  string(16) "/dashboard/admin"
rmrevin commented 9 years ago

What path should be specified in the function "file_get_contents"?

adiramardiani commented 9 years ago

I think the alias show true output, but why show error file_get_contents(C:\xampp\htdocs\dashboard/backend/web/dashboard/admin/assets/3b75345a/css/bootstrap.css) the /dashboard/admin/ is repeat again

rmrevin commented 9 years ago

/dashboard/admin/ its controller? or path to /dashboard/admin/index.php?

adiramardiani commented 9 years ago

I use htaccess to hide frontend and backend folder with htaccess following this link

For frontend as root domain, and backend with admin url, whether it be affects ?

adiramardiani commented 9 years ago

With normal url is http://localhost/dashboard/backend/web and know with htaccess is http://localhost/dashboard/admin

adiramardiani commented 9 years ago

No, Url for frontend http://localhost/dashboard Url for backend http://localhost/dashboard/admin/

Dashboard is my application name

rmrevin commented 9 years ago

I think we understood what a mistake. Seconds.

adiramardiani commented 9 years ago

What the mistake ?

rmrevin commented 9 years ago

Please copy the full error trace.

adiramardiani commented 9 years ago

download

rmrevin commented 9 years ago

In basePath currently @web? Must be @backend/web

adiramardiani commented 9 years ago

I use @app/web or @web or @backend/web still give the wrong output path

rmrevin commented 9 years ago

Show your AssetBundle, which connects bootstrap. Such an error is detected by using baseUrl in AssetBundle. And show config AssetManager.

adiramardiani commented 9 years ago
namespace backend\assets;
use yii\web\AssetBundle;
class BootstrapAsset extends AssetBundle{
    public $sourcePath = '@bower/bootstrap/dist';
    public $css = [
        'css/bootstrap.css',
    ];
    public $js = [
        'js/bootstrap.js',
    ];
}
rmrevin commented 9 years ago

And show config AssetManager.

adiramardiani commented 9 years ago

I'm not configure a assetManager

adiramardiani commented 9 years ago

For now I do not activate Minify

'view' => [
            'class' => '\rmrevin\yii\minify\View',
            'enableMinify' => false,
            'compress_output'=>true
        ]

Html compress is working well, but why are all my ajax page do not work, like GridView pagination etc ?

rmrevin commented 9 years ago

You can grant access to the code? Since we can not diagnose the problem remotely. We need to see how to configure the application.

adiramardiani commented 9 years ago

I use web_path and minify working well now, thanks :) My configure like in your readme file But why are all my ajax page do not work after compressed html page, like GridView pagination etc ?

rmrevin commented 9 years ago

@adiramardiani you use pjax?

adiramardiani commented 9 years ago

Yes of course

rmrevin commented 9 years ago

Try using version 1.8.1

adiramardiani commented 9 years ago

version for what ? pjax or ?

rmrevin commented 9 years ago

yii2-minify-view 1.8.1

adiramardiani commented 9 years ago

Now it working well :) Sorry could not pull request or any others, I was very stupid :p Can only give advice or enhancement, not about technical

Thank you so much

Closed :)

rmrevin commented 9 years ago

I'm glad I could help! Good luck.