Skip to content

Commit

Permalink
enable deferring a script
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Iancu committed Sep 23, 2019
1 parent 72dbfce commit 16f9053
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/directives.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@
|---------------------------------------------------------------------
*/

'script' => function ($expression) {
'script' => function ($expression, $defer = null) {
if (! empty($expression)) {
return '<script src="'.DirectivesRepository::stripQuotes($expression).'"></script>';
list($src, $defer) = explode(',',str_replace(['(',')',' '], '', $expression));
return '<script src="'.DirectivesRepository::stripQuotes($src).'"'.$defer.'></script>';
}

return '<script>';
Expand Down

0 comments on commit 16f9053

Please sign in to comment.