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

index.html « layouts - github.com/gohugoio/hugoTestProjectJSModImports.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e70dd7f33515410b85181faaf13168a2a165c53d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>
      {{ .Title }}
    </title>
    {{ if hugo.IsProduction }}
      {{/* We import from node_modules in development to get code completion etc. working. */}}
      <script src="https://unpkg.com/react@17/umd/react.production.min.js" crossorigin></script>
      <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js" crossorigin></script>
    {{ end }}
    {{ $inject := slice "js/shims/process.js" }}
    {{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false "params" (dict "myparam" "Hugo Rocks!") "inject" $inject ) }}
    <script src="{{ $js.RelPermalink }}"></script>
    {{ partialCached "jslibs/alpinejs/script-src.html" "-" }}
  </head>
  <body class="mt-10">
    <h2>
      Basic Test Cases
    </h2>
    <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="hello6()"></li>
        <li x-text="cwd()"></li>
        <!--li x-text="helloNodeModules()"></li-->
        <li x-text="data.Hugo"></li>
        <li x-text="params.myparam"></li>
      </ul>
    </div>
    <h2>
      React
    </h2>
    <div id="like_button_container"></div>
    {{ $shims := dict }}
    {{ $defines := dict }}
    {{ if hugo.IsProduction }}
      {{ $shims = dict "react" "js/shims/react.js"  "react-dom" "js/shims/react-dom.js" }}
    {{ else }}
      {{ $defines = dict "process.env.NODE_ENV" `"development"` }}
    {{ end }}
    {{ $js := resources.Get "js/like.jsx" | js.Build (dict "shims" $shims "defines" $defines ) }}
    <script src="{{ $js.RelPermalink }}"></script>
  </body>
</html>