Skip to content

Add component function, and example #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/component/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output
html/index.js
node_modules
5 changes: 5 additions & 0 deletions examples/component/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all:
purs compile src/*.purs '../../src/**/*.purs' '../../bower_components/purescript-*/src/**/*.purs'
purs bundle --module Container output/*/*.js > output/bundle.js
echo 'module.exports = PS.Container;' >> output/bundle.js
node_modules/browserify/bin/cmd.js output/bundle.js index.js -o html/index.js
12 changes: 12 additions & 0 deletions examples/component/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Component Example

## Building

```
npm install
make all
```

This will compile the PureScript source files, bundle them, and use Browserify to combine PureScript and NPM sources into a single bundle.

Then open `html/index.html` in your browser.
10 changes: 10 additions & 0 deletions examples/component/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>react-basic example</title>
</head>
<body>
<div id="container"></div>
<script src="index.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions examples/component/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use strict";

var React = require("react");
var ReactDOM = require("react-dom");
var Container = require("./output/bundle.js");

ReactDOM.render(
React.createElement(Container.component, { label: 'Increment' }),
document.getElementById("container")
);
Loading