From f518480fc0ab60a0f27d5f29846e14a939cd0548 Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sat, 14 Jul 2018 17:08:11 -0400 Subject: [PATCH] Add custom template example --- examples/custom-template/README.md | 20 ++++++++++++++++++++ examples/custom-template/package.json | 14 ++++++++++++++ examples/custom-template/src/index.js | 7 +++++++ examples/custom-template/template.js | 17 +++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 examples/custom-template/README.md create mode 100644 examples/custom-template/package.json create mode 100644 examples/custom-template/src/index.js create mode 100644 examples/custom-template/template.js diff --git a/examples/custom-template/README.md b/examples/custom-template/README.md new file mode 100644 index 0000000..f88b756 --- /dev/null +++ b/examples/custom-template/README.md @@ -0,0 +1,20 @@ + +# x0 custom template example + +```sh +npm install +``` + +## Dev Server + +```sh +npm start +``` + +Editing `src/index.js` will live update in the development server. + +## Static Build + +```sh +npm run build +``` diff --git a/examples/custom-template/package.json b/examples/custom-template/package.json new file mode 100644 index 0000000..a4f6c68 --- /dev/null +++ b/examples/custom-template/package.json @@ -0,0 +1,14 @@ +{ + "name": "x0-custom-template-example", + "private": true, + "scripts": { + "start": "x0 src -o", + "build": "x0 build src" + }, + "dependencies": { + "@compositor/x0": "^5.0.0" + }, + "x0": { + "template": "./template.js" + } +} diff --git a/examples/custom-template/src/index.js b/examples/custom-template/src/index.js new file mode 100644 index 0000000..1ea6252 --- /dev/null +++ b/examples/custom-template/src/index.js @@ -0,0 +1,7 @@ +import React from 'react' + +const App = props => ( +

Hello

+) + +export default App diff --git a/examples/custom-template/template.js b/examples/custom-template/template.js new file mode 100644 index 0000000..f0d168c --- /dev/null +++ b/examples/custom-template/template.js @@ -0,0 +1,17 @@ +module.exports = ({ + html = '', + css = '', + scripts, + meta = [], + links = [], +}) => +` + + + + x0 Custom Template + ${css} + +
${html}
+${scripts} +`