-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
137 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
public/ | ||
node_modules/date-fns/ | ||
assets/jsconfig.json | ||
assets/jsconfig.json | ||
!node_modules/ | ||
node_modules/* | ||
!node_modules/mynodemod/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Note: We're using the CDN in "production". | ||
import * as React from 'react' | ||
import * as ReactDOM from "react-dom"; | ||
|
||
// A simple React JSX component. | ||
class LikeButton extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { liked: false }; | ||
} | ||
|
||
render() { | ||
if (this.state.liked) { | ||
return 'You liked this!'; | ||
} | ||
|
||
return ( | ||
<button onClick={() => this.setState({ liked: true }) }> | ||
Like | ||
</button> | ||
); | ||
} | ||
} | ||
|
||
|
||
const domContainer = document.querySelector('#like_button_container'); | ||
ReactDOM.render(<LikeButton />, domContainer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export let ReactDOM = window.ReactDOM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export let React = window.React; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,47 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title> | ||
{{ .Title }} | ||
</title> | ||
{{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false "params" (dict "myparam" "Hugo Rocks!") ) }} | ||
<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="hello6()"></li> | ||
<li x-text="helloNodeModules()"></li> | ||
<li x-text="data.Hugo"></li> | ||
<li x-text="params.myparam"></li> | ||
</ul> | ||
</div> | ||
<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.development.js" crossorigin></script> | ||
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script> | ||
{{ end }} | ||
{{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false "params" (dict "myparam" "Hugo Rocks!") ) }} | ||
<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="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> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters