File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package conf
22
33import (
4- stdtpl "html/template"
54 "net/http"
6- "strings"
75
86 "github.com/zrcoder/amisgo/internal/conf"
97 "github.com/zrcoder/amisgo/internal/template"
3129type Config struct {
3230 Title string
3331 Icon string
34- CustomCSS stdtpl. CSS
35- CustomJS stdtpl. JS
32+ CustomCSS [] string
33+ CustomJS [] string
3634 LocalSdkFS http.FileSystem
3735 * template.Templ
3836}
@@ -108,14 +106,14 @@ func WithIcon(icon string) Option {
108106// WithCustomCSS sets the custom CSS URL.
109107func WithCustomCSS (customCSS ... string ) Option {
110108 return func (c * Config ) {
111- c .CustomCSS = stdtpl . CSS ( strings . Join ( customCSS , " \n " ))
109+ c .CustomCSS = customCSS
112110 }
113111}
114112
115113// WithCustomJS sets the custom JavaScript URL.
116114func WithCustomJS (customJS ... string ) Option {
117115 return func (c * Config ) {
118- c .CustomJS = stdtpl . JS ( strings . Join ( customJS , " \n " ))
116+ c .CustomJS = customJS
119117 }
120118}
121119
Original file line number Diff line number Diff line change 2727 <link rel= " stylesheet" href= " {{ .AmisBaseURL }}@{{ .AmisVersion }}/sdk/helper.min.css" />
2828 <link rel= " stylesheet" href= " {{ .AmisBaseURL }}@{{ .AmisVersion }}/sdk/iconfont.min.css" />
2929 {{ end }}
30+
31+ {{ range .CustomCSS }}
32+ <link rel= " stylesheet" href= " {{.}}" />
33+ {{ end }}
34+
35+ {{ range .CustomJS }}
36+ <script src= " {{.}}" ></script>
37+ {{ end }}
3038
3139 <style>
3240 html ,
3846 margin: 0;
3947 padding: 0;
4048 }
41- {{ .CustomCSS }}
4249 </style>
4350 </head>
4451 <body>
4855 {{ else }}
4956 <script src= " {{ .AmisBaseURL }}@{{ .AmisVersion }}/sdk/sdk.min.js" ></script>
5057 {{ end }}
51- {{ if .CustomJS }}
52- <script type= " text/javascript" >
53- {{ .CustomJS }}
54- </script>
55- {{ end }}
5658 <script type= " text/javascript" >
5759 (function () {
5860 let amis = amisRequire('amis/embed');
You can’t perform that action at this time.
0 commit comments