forked from golang/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.go
38 lines (31 loc) · 846 Bytes
/
content.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package website exports the static content as an embed.FS.
package website
import (
"embed"
"io/fs"
)
// Content returns the go.dev website's static content.
func Content() fs.FS {
return subdir(embedded, "_content")
}
// TourOnly returns the content needed only for the standalone tour.
func TourOnly() fs.FS {
return subdir(tourOnly, "_content")
}
//go:embed _content
var embedded embed.FS
//go:embed _content/favicon.ico
//go:embed _content/images/go-logo-white.svg
//go:embed _content/js/playground.js
//go:embed _content/tour
var tourOnly embed.FS
func subdir(fsys fs.FS, path string) fs.FS {
s, err := fs.Sub(fsys, path)
if err != nil {
panic(err)
}
return s
}