diff --git a/layouts/partials/resource_builders/build_js.html b/layouts/partials/resource_builders/build_js.html
index e859d6e..c756591 100644
--- a/layouts/partials/resource_builders/build_js.html
+++ b/layouts/partials/resource_builders/build_js.html
@@ -1,6 +1,7 @@
{{- $resourcePath := .resource -}}
{{- $minify := .minify | default true -}}
{{- $resource := dict -}}
+
{{- with resources.Get $resourcePath }}
{{- if eq hugo.Environment "development" }}
{{- with . | js.Build }}
@@ -12,7 +13,7 @@
{{ $resource = . }}
{{- end }}
{{- end }}
-{{ else }}
+{{- else }}
{{ warnf "Unable to find JavaScript resource: %s" $resourcePath }}
{{- end }}
diff --git a/layouts/partials/resource_builders/script.html b/layouts/partials/resource_builders/script.html
index 83efe81..51e5ba8 100644
--- a/layouts/partials/resource_builders/script.html
+++ b/layouts/partials/resource_builders/script.html
@@ -19,23 +19,22 @@ looked up and built.
{{- $shouldMinify := .minify -}}
{{- $isModule := .module | default false -}}
-{{ if eq (printf "%T" $resource) "string" }}
+{{- if eq (printf "%T" $resource) "string" }}
{{
$resource = partial "resource_builders/build_js.html"
(dict "resource" $resource "minify" $shouldMinify)
}}
-{{ end }}
+{{- end -}}
-{{ with $resource }}
- {{ if eq hugo.Environment "development" }}
-
- {{ else }}
-
- {{ end }}
-{{ end }}
+{{- with $resource }}
+ {{- if eq hugo.Environment "development" }}
+
+ {{- else }}
+
+ {{- end }}
+{{- end -}}