Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset compressing AssetController unusable in current state #7414

Closed
dynasource opened this issue Feb 24, 2015 · 6 comments
Closed

Asset compressing AssetController unusable in current state #7414

dynasource opened this issue Feb 24, 2015 · 6 comments

Comments

@dynasource
Copy link
Member

I am having so many errors with Asset compression & the current implementation of the yii\console\controllers\AssetController that I am wondering if it is ready yet, or that there is something completely wrong at my side (windows).

All the errors relate to files not (yet) existing and folders not yet existing. With an automation tool based on your own config files, I would not expect to get any setback based on file/folder existence, especially if these are temporary.

Before going in to much detail here, is there anyone who hasnt got this in a windows setup and got it working immediately without fixing files/folders or something like that?

In my case I have had to add multiple lines to assetcontroller to get the JS working. For the CSS similar fixes werent enough, leaving me to continue further debugging to get the tmp CSS file correctly loaded into to the final css file. Perhabs it is not fully ready yet or it could use some extra fixes. If so I will create a push request with the fixes that made it working on my setup.

@cebe
Copy link
Member

cebe commented Feb 24, 2015

we even have a test for the assetcontroller so it should work fine in most cases... https://github.com/yiisoft/yii2/blob/master/tests/unit/framework/console/controllers/AssetControllerTest.php

Please describe in more detail what kind of errors you see.

@klimov-paul
Copy link
Member

Sounds like your console environment does not have OS permissions for write operations in necessary catalogs.

@dynasource
Copy link
Member Author

thanks, I will dive in to it and report

@dynasource
Copy link
Member Author

Ill put some errors for meta:

Error because of js-folder wasnt existing (T:/wc6/assets/js). Its gone if you create it manually

Compressing JavaScript files...
PHP Warning 'yii\base\ErrorException' with message 'file_put_contents(T:/wc6/assets/js/all-temp.js.tmp): failed to open stream: No such file or directory'

in E:\xampp\htdocs\dmn\yii2\core\vendor\yiisoft\yii2\console\controllers\AssetController.php:545

Error because all-temp.css is not existing:

PHP Warning 'yii\base\ErrorException' with message 'md5_file(T:/wc6/assets/all-temp.css): failed to open stream: No such file or directory'

in E:\xampp\htdocs\dmn\yii2\core\vendor\yiisoft\yii2\console\controllers\AssetController.php:348

other error in which tmp file is renamed too soon

  Compressing CSS files...
java.io.FileNotFoundException: \wc6\assets\all-temp.css:\wc6\assets\all-temp.css.tmp (The filename, directory name, or volume label syntax is incorrect)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:208)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Error: Unable to compress CSS files into 'T:/wc6/assets/all-temp.css'.

@dynasource
Copy link
Member Author

when I use an existing folder for the JS, it works for the JS. I do think this should be done by:

\yii\helpers\FileHelper::createDirectory($outputFilePath);

@dynasource
Copy link
Member Author

alright, found the issue for the CSS problem. Its because of yuicompressor 2.4.8:

  • latest version of yuicompressor does not parse absolute URLS

see:

Solution:

Works fine now

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants