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

how to add async attribute to javascript tag? #36

Open
webpaul85 opened this issue Aug 25, 2017 · 1 comment
Open

how to add async attribute to javascript tag? #36

webpaul85 opened this issue Aug 25, 2017 · 1 comment

Comments

@webpaul85
Copy link

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
Copy link

strngr commented Aug 29, 2018

There is jsOptions property in config.

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

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

No branches or pull requests

2 participants