Now I use the following code in my baseof.html
to make use of Hugo’s execellent asset pipeline:
{{/* <!-- CSS --> */}}
{{ $sassIncludes := (slice "node_modules" "assets/scss/vendor" "assets/scss/components") }}
{{ $target := "styles/main.css" }}
{{ if .Site.IsServer }}
{{ $cssOpts := (dict "targetPath" $target "enableSourceMap" true "includePaths" $sassIncludes ) }}
{{ $styles := resources.Get "scss/main.scss" | toCSS $cssOpts }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ else }}
{{ $cssOpts := (dict "targetPath" $target "includePaths" $sassIncludes ) }}
{{ $styles := resources.Get "scss/main.scss" | toCSS $cssOpts | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
{{ end }}
{{/* <!-- JavaScript --> */}}
{{/* <!-- NOTE: Vendor Scripts --> */}}
{{ $jquery := resources.Get "/js/jquery/dist/jquery.js" }}
{{ $bootstrap := resources.Get "/js/bootstrap/dist/js/bootstrap.js" }}
{{ $popper := resources.Get "/js/popper/popper.js" }}
{{/* <!-- NOTE: User Scripts --> */}}
{{ $user := resources.Get "/js/user.js" }}
{{ $scripts := resources.Get "/js/scripts.js" }}
{{ if .Site.IsServer }}
{{ $script := slice $jquery $bootstrap $popper $scripts $user | resources.Concat "/js/bundle.js" }}
<script src="{{ $script.Permalink }}"></script>
{{ else }}
{{ $script := slice $jquery $bootstrap $popper $scripts $user | resources.Concat "/js/bundle.js" | minify | fingerprint }}
<script src="{{ $script.Permalink }}"></script>
{{ end }}