Closed dynasource closed 9 years ago
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.
Sounds like your console environment does not have OS permissions for write operations in necessary catalogs.
thanks, I will dive in to it and report
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'.
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);
alright, found the issue for the CSS problem. Its because of yuicompressor 2.4.8:
see:
Solution:
Works fine now
thanks
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.