omi-srr - test scoped css
This commit is contained in:
parent
2a31a35bbd
commit
a6f25c5350
|
@ -5,6 +5,7 @@
|
|||
"transform-es2015-modules-commonjs",
|
||||
"transform-es2015-spread",
|
||||
"transform-es2015-destructuring",
|
||||
"transform-es2015-parameters"
|
||||
"transform-es2015-parameters",
|
||||
"transform-class-properties"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
||||
"babel-plugin-transform-es2015-parameters": "^6.24.1",
|
||||
|
|
|
@ -4,10 +4,14 @@ var Omi = require('omio')
|
|||
require('./my-element')
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
const obj = Omi.renderToString(<my-element />)
|
||||
res.end(`<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head><title>Omi SSR</title></head>
|
||||
<body>${Omi.renderToString(<my-element />).html}</body>
|
||||
<head>
|
||||
<title>Omi SSR</title>
|
||||
${obj.css.join('')}
|
||||
</head>
|
||||
<body>${obj.html}</body>
|
||||
</html>`)
|
||||
})
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ define('my-element', class extends WeElement {
|
|||
this.data = { liked: false }
|
||||
}
|
||||
|
||||
static css = 'button{ color: red; }'
|
||||
|
||||
render() {
|
||||
if (this.data.liked) {
|
||||
return 'You liked this.'
|
||||
|
|
Loading…
Reference in New Issue