mirror of
https://github.com/c8r/x0.git
synced 2024-09-11 13:45:52 +03:00
Add JSX support
This commit is contained in:
parent
a819482d4a
commit
3751b5923c
14
docs/hello.jsx
Normal file
14
docs/hello.jsx
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
title: Hello JSX
|
||||
jsxLink: https://github.com/c8r/jsx-loader
|
||||
---
|
||||
<div>
|
||||
<h1>{props.title}</h1>
|
||||
<p>
|
||||
x0 supports
|
||||
{' '}
|
||||
<a href={props.jsxLink}>Compositor JSX</a>
|
||||
{' '}
|
||||
format
|
||||
</p>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Compositor x0"><title>Compositor x0</title><style>*{box-sizing:border-box}body{margin:0;font-family:system-ui,sans-serif}</style></head><div id="root"><h1>x0</h1></div>
|
@ -1,9 +1,31 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
export default class extends React.Component {
|
||||
render () {
|
||||
return (
|
||||
<h1>x0</h1>
|
||||
<React.Fragment>
|
||||
<h1>x0</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<Link to='/'>Home</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link to='/hello'>Hello JSX</Link>
|
||||
</li>
|
||||
</ul>
|
||||
<video
|
||||
style={{
|
||||
maxWidth: '100%',
|
||||
height: 'auto'
|
||||
}}
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline>
|
||||
<source src='/demo.mp4' />
|
||||
</video>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -16,20 +16,21 @@ const rules = [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: babel
|
||||
}
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: babel
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: path.resolve(__dirname, '../node_modules'),
|
||||
include: path.resolve(__dirname),
|
||||
use: {
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: babel
|
||||
}
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: babel
|
||||
},
|
||||
{
|
||||
test: /\.jsx$/,
|
||||
loader: require.resolve('@compositor/jsx-loader'),
|
||||
options: {}
|
||||
}
|
||||
]
|
||||
|
||||
// common config
|
||||
|
@ -21,6 +21,7 @@ module.exports = async (opts) => {
|
||||
const template = createTemplate(opts)
|
||||
|
||||
config.mode = 'development'
|
||||
config.context = opts.dirname
|
||||
config.entry = path.join(__dirname, './entry')
|
||||
config.output= {
|
||||
path: path.join(process.cwd(), 'dev'),
|
||||
|
@ -17,6 +17,7 @@
|
||||
"author": "Brent Jackson",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@compositor/jsx-loader": "^1.0.0-2",
|
||||
"@compositor/log": "^1.0.0-0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
|
Loading…
Reference in New Issue
Block a user