summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.editorconfig4
-rw-r--r--config.toml4
-rw-r--r--config.yaml15
-rw-r--r--go.mod5
-rw-r--r--go.sum4
-rw-r--r--layouts/partials/scripts.html9
-rw-r--r--package.json8
7 files changed, 36 insertions, 13 deletions
diff --git a/.editorconfig b/.editorconfig
index 0ec9ed4..cf6798b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -17,3 +17,7 @@ indent_size = 2
[layouts/**.{svg}]
insert_final_newline = false
+
+[go.{mod,sum}]
+indent_style = tab
+indent_size = 4
diff --git a/config.toml b/config.toml
deleted file mode 100644
index c765f7e..0000000
--- a/config.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-[module]
- [module.hugoVersion]
- extended = true
- min = "0.95.0"
diff --git a/config.yaml b/config.yaml
new file mode 100644
index 0000000..1e66daa
--- /dev/null
+++ b/config.yaml
@@ -0,0 +1,15 @@
+module:
+
+ hugoVersion:
+ extended: true
+ min: '0.95.0'
+
+ imports:
+ - path: github.com/jquery/jquery-dist
+ mounts:
+ - source: dist/jquery.js
+ target: assets/js/vendor/jquery.js
+ - path: github.com/olivernn/lunr.js
+ mounts:
+ - source: lunr.js
+ target: assets/js/vendor/lunr.js
diff --git a/go.mod b/go.mod
index 002ccfa..2d44fd9 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,8 @@
module github.com/sergeyklay/gohugo-theme-ed
go 1.18
+
+require (
+ github.com/jquery/jquery-dist v0.0.0-20210302171154-e786e3d9707f // indirect
+ github.com/olivernn/lunr.js v2.3.9+incompatible // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..b6892c2
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,4 @@
+github.com/jquery/jquery-dist v0.0.0-20210302171154-e786e3d9707f h1:VrcFwwDo/nKErNIKmp//iOGu7DlRkBTeW//hN7tl7SU=
+github.com/jquery/jquery-dist v0.0.0-20210302171154-e786e3d9707f/go.mod h1:/lTfttEqFU0GWTaOOMIeNTzLGQ7yTIgyzjtkS/pYIoc=
+github.com/olivernn/lunr.js v2.3.9+incompatible h1:eH8iBnjlR4mwlYDdNuqy9PCNLjp2bEs6aoNnTSaccx0=
+github.com/olivernn/lunr.js v2.3.9+incompatible/go.mod h1:yEkQ1DUSMtNsn8n2CqvQXZd0ErWPEG8g9QRmblR+KS8=
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index d04bfbe..02634ad 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -1,11 +1,14 @@
{{- $vendors := slice -}}
-{{- $vendorNames := slice "jquery.min" "lunr.min" -}}
+{{- $vendorNames := slice "jquery.js" "lunr.js" -}}
{{- range $vendorNames -}}
- {{ $vendors = $vendors | append (resources.Get (printf "js/vendor/%s.js" .) ) }}
+ {{ $vendors = $vendors | append (resources.Get (printf "js/vendor/%s" .) ) }}
{{- end -}}
-{{- $vendors := $vendors | resources.Concat "js/vendor-bundle.js" | minify -}}
+{{- $vendors = $vendors | resources.Concat "js/vendor-bundle.js" -}}
+{{- if or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production") }}
+ {{- $vendors = $vendors | minify -}}
+{{- end -}}
{{- if not site.Params.assets.disable_fingerprinting -}}
{{- $vendors = $vendors | fingerprint -}}
diff --git a/package.json b/package.json
index f8e2506..56e8b2e 100644
--- a/package.json
+++ b/package.json
@@ -29,13 +29,9 @@
"server": "HUGO_PREVIEW=true HUGO_ENV=development hugo server --verbose --source=exampleSite --buildDrafts --buildFuture --ignoreCache --disableFastRender",
"lint": "npm run lint:js && npm run lint:editorconfig",
"lint:editorconfig": "editorconfig-checker",
- "lint:js": "eslint static/js/*.js assets/js/*.js",
- "vendor:js": "ncp node_modules/jquery/dist/jquery.min.js assets/js/vendor/jquery.min.js; ncp node_modules/lunr/lunr.min.js assets/js/vendor/lunr.min.js"
- },
- "dependencies": {
- "jquery": "^3.6.0",
- "lunr": "^2.3.9"
+ "lint:js": "eslint static/js/*.js assets/js/*.js"
},
+ "dependencies": {},
"devDependencies": {
"editorconfig-checker": "^4.0.2",
"eslint": "^8.19.0",