skeeks-semenov / yii2-assets-auto-compress

Automatic compilation of js + css + html
https://skeeks.com/
BSD 3-Clause "New" or "Revised" License
157 stars 43 forks source link

how to add async attribute to javascript tag? #36

Open webpaul85 opened 6 years ago

webpaul85 commented 6 years ago

In my AssetBundle I can set the "async" attribute for javascript tag adding:

public $jsOptions = [
    'async' => 'async',
];

But when the javascript is compressed, the async attribute disappear. Is it possible to keep it (or to set it somewhere else?).

Thanks

strngr commented 5 years ago

There is jsOptions property in config.

'assetsAutoCompress' => [
        'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
        'jsCompress' => true,
        'jsCompressFlaggedComments' => true,
        'jsOptions' => [
            'async' => 'async',
        ],
    ],