widmogrod / zf2-assetic-module

Zend Framework module for Assetic
146 stars 62 forks source link

Remove Render-Blocking JavaScript #124

Closed jarrettj closed 9 years ago

jarrettj commented 9 years ago

Is it possible to add the async attribute to a script tag?

Been reading https://developers.google.com/speed/docs/insights/BlockingJS

jarrettj commented 9 years ago

I've done a string replace on the script:

        $script = $this->plugin('HeadScript')->toString();
        $scriptAsync = preg_replace('/<script/', '<script async', $script);
        echo $scriptAsync;