Skip to content

Commit

Permalink
Modify asset cache busting handler
Browse files Browse the repository at this point in the history
  • Loading branch information
robbinjohansson committed Feb 8, 2018
1 parent 5354003 commit 28fce37
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 2 additions & 3 deletions haywire.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public function onThemeInitialized()

public function onTwigSiteVariables()
{
$path = $this->grav['base_url'] . $this->config['theme']['assetPath'];
$manifest = __DIR__ . '/dist/mix-manifest.json';

if (file_exists($manifest)) {
$assets = json_decode(file_get_contents($manifest), true);
$this->grav['assets']->addJs($path . $assets['/js/app.js'], ['group' => 'bottom']);
$this->grav['assets']->addCss($path . $assets['/css/app.css']);
$this->grav['assets']->addJs('theme://dist/' . $assets['/js/app.js'], ['group' => 'bottom']);
$this->grav['assets']->addCss('theme://dist/' . $assets['/css/app.css'],10);
}
}

Expand Down
2 changes: 0 additions & 2 deletions haywire.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
assetPath: /user/themes/haywire/dist

enabled: true
dropdown:
enabled: true
Expand Down
4 changes: 1 addition & 3 deletions templates/partials/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
{% include 'partials/footer.html.twig' %}
</div>

{% block bottom %}
{{ assets.js('bottom') }}
{% endblock %}
{{ assets.js('bottom') }}
</body>
</html>

1 comment on commit 28fce37

@robbinjohansson
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible fix for #14, #15, pending.

Please sign in to comment.