diff options
Diffstat (limited to 'phpBB/includes/template/twig/node/includejs.php')
-rw-r--r-- | phpBB/includes/template/twig/node/includejs.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index bba5d4ef91..91b24e8068 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -31,9 +31,17 @@ class phpbb_template_twig_node_includejs extends Twig_Node $config = $this->environment->get_phpbb_config(); $compiler - ->write("\$context['definition']->append('SCRIPTS', '<script type=\"text/javascript\" src=\"' . ") + ->write("\$js_file = ") ->subcompile($this->getNode('expr')) - ->raw(" . '?assets_version=" . $config['assets_version'] . "\"></script>');\n") + ->raw(";\n") + ->write("if (!file_exists(\$js_file)) {\n") + ->indent() + ->write("\$js_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$js_file);\n") + ->outdent() + ->write("}\n") + ->write("\$context['definition']->append('SCRIPTS', '<script type=\"text/javascript\" src=\"' . ") + ->raw("\$js_file") + ->raw(" . '?assets_version=" . $config['assets_version'] . "\"></script>\n');\n") ; } } |