1
1
mirror of https://github.com/c8r/x0.git synced 2024-08-16 17:00:24 +03:00

Add custom template example

This commit is contained in:
Brent Jackson 2018-07-14 17:08:11 -04:00
parent 01333369ab
commit f518480fc0
4 changed files with 58 additions and 0 deletions

View File

@ -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
```

View File

@ -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"
}
}

View File

@ -0,0 +1,7 @@
import React from 'react'
const App = props => (
<h1>Hello</h1>
)
export default App

View File

@ -0,0 +1,17 @@
module.exports = ({
html = '',
css = '',
scripts,
meta = [],
links = [],
}) =>
`<!DOCTYPE html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>x0 Custom Template</title>
${css}
</head>
<div id=root>${html}</div>
${scripts}
`