Skip to content

Commit

Permalink
Outline
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Oct 12, 2020
1 parent ce3e2b7 commit 1432b6a
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public/
node_modules/
3 changes: 3 additions & 0 deletions assets/js/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function hello4() {
return 'Hello from lib in the main project';
}
18 changes: 18 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
@@ -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;
11 changes: 11 additions & 0 deletions assets/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": [
"../../hugoTestModulesJS/mod1/assets/*",
"../../hugoTestModulesJS/mod2/assets/*"
]
}
}
}
19 changes: 19 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
21 changes: 21 additions & 0 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 1432b6a

Please sign in to comment.