简体   繁体   中英

Error when compressing Assets Yii2

I want to compress my assets but compressing is not working; I need to understand I am doing wrong in my configuration and if the problem is not with my configuration then what the error means.

Here is my configuration :

Yii::setAlias('@webroot',realpath(__DIR__ . '/../../public_html'));
 Yii::setAlias('@web', '/');

return [
    // Adjust command/callback for JavaScript files compressing:
    'jsCompressor' => 'java -jar assets/compression/closurecompilerv20160911.jar --js {from} --js_output_file {to}',
    // Adjust command/callback for CSS files compressing:
    'cssCompressor' => 'java -jar assets/compression/yuicompressor2.4.8.jar --type css {from} -o {to}',
    // The list of asset bundles to compress:
    'bundles' => [
         'app\assets\AppAsset',
        'yii\widgets\ActiveFormAsset',
        'yii\grid\GridViewAsset',
        'yii\validators\ValidationAsset',
    ],
    // Asset bundle for compression output:
    'targets' => [
        'app\\assets\\CompressedAsset' => [
            'class' => 'yii\web\AssetBundle',
            'basePath' =>  '@webroot',
            'baseUrl' => '@web',
            'js' => 'js/all-{hash}.js',
            'css' => 'css/all-{hash}.css',
        ],
    ],
    // Asset manager configuration:
    'assetManager' => [
        'basePath' => '@webroot/js',
        'baseUrl' => '@web/css',
    ],
];

And the error is starting from :

C:/wamp/www/coutde/public_html/js/all-temp.js.tmp:1930: WARNING - Suspicious code. The result of the 'getprop' operator is not being used. $("#diffusion-nom").val(data.reussite.nom).focus; ^

C:/wamp/www/coutde/public_html/js/all-temp.js.tmp:2166: WARNING - Suspicious code. The result of the 'getprop' operator is not being used. $("#prix-cout").val(data.reussite.cout).focus; ^

C:/wamp/www/coutde/public_html/js/all-temp.js.tmp:2240: WARNING - Suspicious code. The result of the 'getprop' operator is not being used. $("#schedule-details").val(data.reussite.details).focus; ^

C:/wamp/www/coutde/public_html/js/all-temp.js.tmp:2317: WARNING - Suspicious code. The result of the 'getprop' operator is not being used. nom.val(data.reussite.nom).focus; ^

0 error(s), 9 warning(s) JavaScript files compressed into 'C:\\wamp\\www\\coutde\\public_html/js/all-temp.js'. Compressing CSS files... java.io.FileNotFoundException: wampwwwcoutdepublic_html\\css\\all-temp.css:\\wamp\\www\\coutde\\public_html\\css\\all-temp.css.tmp (The filename, directory name, or volume label syntax is incorrect) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(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 'C:\\wamp\\www\\coutde\\public_html/css/all-temp.css'.

尝试yuicompressor-2.4.7.jar-遇到相同的错误,它有所帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM