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} +`