Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugoTestProjectJSModImports.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-09 14:09:48 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-12 13:10:00 +0300
commit1432b6ab3b88fac4b26f647df787510ad714319a (patch)
tree50f2173b606b8d7ff619980e925f482ee0d09008
parentce3e2b7596217632a851000b52c25de66783b22e (diff)
Outlinev0.1.0
-rw-r--r--.gitignore2
-rw-r--r--assets/js/lib/index.js3
-rw-r--r--assets/js/main.js18
-rw-r--r--assets/jsconfig.json11
-rw-r--r--config.toml19
-rw-r--r--go.mod13
-rw-r--r--go.sum16
-rw-r--r--layouts/index.html21
8 files changed, 103 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b418425
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+public/
+node_modules/ \ No newline at end of file
diff --git a/assets/js/lib/index.js b/assets/js/lib/index.js
new file mode 100644
index 0000000..1c791ee
--- /dev/null
+++ b/assets/js/lib/index.js
@@ -0,0 +1,3 @@
+export function hello4() {
+ return 'Hello from lib in the main project';
+}
diff --git a/assets/js/main.js b/assets/js/main.js
new file mode 100644
index 0000000..3ed0231
--- /dev/null
+++ b/assets/js/main.js
@@ -0,0 +1,18 @@
+// From mod1, but get its data from mod2.
+import { hello1 } from 'core/util';
+// From mod1
+import { hello2 } from 'core/util';
+// From mod2
+import * as data from 'core/util/data.json';
+// hello3 lives in mod2 which also have a index.js in util.
+// But doing import from 'core/util' you will get the index.js file from mod1
+// (higher up in the import list), so we need to be explicit:
+import { hello3 } from 'core/util/hello3';
+// From main
+import { hello4 } from './lib';
+
+window.hello1 = hello1;
+window.hello2 = hello2;
+window.hello3 = hello3;
+window.hello4 = hello4;
+window.data = data;
diff --git a/assets/jsconfig.json b/assets/jsconfig.json
new file mode 100644
index 0000000..aaa17c7
--- /dev/null
+++ b/assets/jsconfig.json
@@ -0,0 +1,11 @@
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "*": [
+ "../../hugoTestModulesJS/mod1/assets/*",
+ "../../hugoTestModulesJS/mod2/assets/*"
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/config.toml b/config.toml
new file mode 100644
index 0000000..3fab18c
--- /dev/null
+++ b/config.toml
@@ -0,0 +1,19 @@
+baseURL = "https://example.org"
+
+disableKinds = ["page", "section", "term", "taxonomy"]
+
+
+[module]
+[[module.imports]]
+path="github.com/gohugoio/hugoTestModulesJS/mod1"
+[[module.imports]]
+path="github.com/gohugoio/hugoTestModulesJS/mod2"
+[[module.imports]]
+path="github.com/date-fns/date-fns"
+[[module.imports.mounts]]
+source="src"
+target="assets/date"
+
+[[module.imports]]
+# This is not relevant for the testing itself.
+path = "github.com/bep/hugo-jslibs/alpinejs" \ No newline at end of file
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..1e45ab2
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,13 @@
+module github.com/gohugoio/hugoTestProjectJSModImports
+
+go 1.15
+
+require (
+ github.com/bep/hugo-jslibs/alpinejs v0.5.14 // indirect
+ github.com/date-fns/date-fns v2.16.1+incompatible // indirect
+ github.com/gohugoio/hugoTestModulesJS/mod1 v0.0.0-20201011174806-5f7e20f9ff4a // indirect
+ github.com/gohugoio/hugoTestModulesJS/mod2 v0.0.0-20201011192008-decf54abafdd // indirect
+)
+
+replace github.com/gohugoio/hugoTestModulesJS/mod1 => ../hugoTestModulesJS/mod1
+replace github.com/gohugoio/hugoTestModulesJS/mod2 => ../hugoTestModulesJS/mod2 \ No newline at end of file
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..878c765
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,16 @@
+github.com/alpinejs/alpine v2.5.0+incompatible/go.mod h1:BKI81egATMnaKqFeX5HEfYMnjZjcjcZmrYAu5Nck+EY=
+github.com/bep/hugo-jslibs v0.0.0-20200822141830-44620243312e h1:JWYiSAOCdD0HO7ySFZgwiQcq4/vqObqTqesFSJ2sesw=
+github.com/bep/hugo-jslibs/alpinejs v0.5.14 h1:PeZOraYYU+bH10G2Y/5M5VJsqOQyLAWCukvUIyQeTlE=
+github.com/bep/hugo-jslibs/alpinejs v0.5.14/go.mod h1:AKan86yhrI16Cp+ga/+UuRkBgaO25SpubHWFgMTzh3o=
+github.com/date-fns/date-fns v1.30.1 h1:zxR21/H1aFIN9dJnRPgWzm/d4vMjiPv0daTAJ+lJYJk=
+github.com/date-fns/date-fns v2.16.1+incompatible h1:MhC76uGURHPWnZhfKDJs+ckojxxKwAFd3D/7VN3NQKo=
+github.com/date-fns/date-fns v2.16.1+incompatible/go.mod h1:+ryiPUdf29FTxQJUxCwq0ip75zSWtk43q+htSAQLdFU=
+github.com/gohugoio/hugoTestModulesJS v0.0.0-20201010100233-8db744a82e35 h1:Cha7HDCdZ57kmJpY5GgHNPoW8R1aRCHm9vOTe4wmJOg=
+github.com/gohugoio/hugoTestModulesJS v0.0.0-20201011192008-decf54abafdd h1:IyL0HL6wUsRyCDelBh38gfDoiKMpJRrSJZDDdUVsiKo=
+github.com/gohugoio/hugoTestModulesJS/mod1 v0.0.0-20201010100233-8db744a82e35/go.mod h1:IfctxwCwBB4wVUA+bUb4o5x2mvphWPXVLhKaclkpwz4=
+github.com/gohugoio/hugoTestModulesJS/mod1 v0.0.0-20201010100603-5c7000b063e3 h1:6oAL5GX/uwfxpHog2bvTq2ARbf/strSuRZIX/KjZbIg=
+github.com/gohugoio/hugoTestModulesJS/mod1 v0.0.0-20201010100603-5c7000b063e3/go.mod h1:IfctxwCwBB4wVUA+bUb4o5x2mvphWPXVLhKaclkpwz4=
+github.com/gohugoio/hugoTestModulesJS/mod1 v0.0.0-20201011174806-5f7e20f9ff4a h1:h/+C4m4Aav50zgU2pfm2+GpuhoEgwVKkiRhDK2fjADs=
+github.com/gohugoio/hugoTestModulesJS/mod1 v0.0.0-20201011174806-5f7e20f9ff4a/go.mod h1:IfctxwCwBB4wVUA+bUb4o5x2mvphWPXVLhKaclkpwz4=
+github.com/gohugoio/hugoTestModulesJS/mod2 v0.0.0-20201011192008-decf54abafdd h1:Uu3lXkigL0q13sVksE7NVnoPTyxx4ViYKrNA70QDKA4=
+github.com/gohugoio/hugoTestModulesJS/mod2 v0.0.0-20201011192008-decf54abafdd/go.mod h1:uynOkor8I03PIUuDZN4NYQ+Bmkye7vNLV5tRUBC2+10=
diff --git a/layouts/index.html b/layouts/index.html
new file mode 100644
index 0000000..2f8a43d
--- /dev/null
+++ b/layouts/index.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>
+ {{ .Title }}
+ </title>
+ {{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false ) }}
+ <script src="{{ $js.RelPermalink }}"></script>
+ {{ partialCached "jslibs/alpinejs/script-src.html" "-" }}
+</head>
+<body class="mt-10">
+<div class="" x-data="{}">
+ <ul>
+ <li x-text="hello1()"></li>
+ <li x-text="hello2()"></li>
+ <li x-text="hello3()"></li>
+ <li x-text="hello4()"></li>
+ <li x-text="data.Hugo"></li>
+ </ul>
+</div> \ No newline at end of file