Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Rewrite ¶
Example ¶
package main
import (
"os"
"github.com/matthewmueller/styledjsx"
)
func main() {
const jsx = `
export default () => (
<main class="main">
<h1>hello</h1>
<style scoped>{` + "`" + `
.main {
background: blue;
}
h1 {
color: red;
}
` + "`" + `}</style>
</main>
)
`
rewriter := styledjsx.New()
rewriter.Minify = true
example, _ := rewriter.Rewrite("example.jsx", jsx)
os.Stdout.WriteString(example)
}
Output: import Style from "styled-jsx"; export default () => ( <main class="jsx-8mUTT main"> <h1 class="jsx-8mUTT">hello</h1> <Style scoped id="jsx-8mUTT">{`.main.jsx-8mUTT{background:#00f}h1.jsx-8mUTT{color:red}`}</Style> </main> )
Types ¶
Click to show internal directories.
Click to hide internal directories.