dis: Rework styling and build procedure
This commit is contained in:
parent
1e1d1a3cad
commit
cdc7d69ad9
51 changed files with 1251 additions and 339 deletions
34
pkg/resources/resources_test.go
Normal file
34
pkg/resources/resources_test.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package resources
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ExampleParse() {
|
||||
resources := Parse(strings.NewReader(`
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/some/sheet1.css">
|
||||
<link rel="stylesheet" href="/some/sheet2.css">
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" src="/some/module1.js"></script>
|
||||
<script type="module" src="/some/module2.js"></script>
|
||||
<script src="/some/nonmodule1.js"></script>
|
||||
<script src="/some/nonmodule2.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
`))
|
||||
|
||||
var builder strings.Builder
|
||||
builder.WriteString("css: ")
|
||||
resources.WriteCSS(&builder)
|
||||
|
||||
builder.WriteString("\njs: ")
|
||||
resources.WriteJS(&builder)
|
||||
fmt.Println(builder.String())
|
||||
|
||||
// Output: css: <link rel=stylesheet href="/some/sheet1.css"><link rel=stylesheet href="/some/sheet2.css">
|
||||
// js: <script type=module src="/some/module1.js"><script type=module src="/some/module2.js"><script src="/some/nonmodule1.js"><script src="/some/nonmodule2.js">
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue