enable reading template variable from JS files

This commit is contained in:
mivinci 2021-08-23 21:40:38 +08:00
parent e7eb6932e2
commit e90b28cd24
4 changed files with 9 additions and 5 deletions

View file

@ -24,8 +24,8 @@
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ $options := (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
{{ $js := resources.Get "js/main.js" | js.Build $options }}
{{ $options = (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate (printf `minima.%d.js` $hash) . }}
<script defer type="text/javascript" src="{{ $js.RelPermalink }}"></script>
</head>
<script>