Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(admin): use go1.16 embed for templates and assets
- Loading branch information
Showing
9 changed files
with
78 additions
and
11,322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
//nolint:gochecknoglobals,golint,stylecheck | ||
package assets | ||
|
||
import ( | ||
"strings" | ||
"embed" | ||
) | ||
|
||
// PrefixDo runs a given callback for every path in our assets with | ||
// the given prefix | ||
func PrefixDo(pre string, cb func(path string, asset *EmbeddedAsset)) { | ||
for path, asset := range Bytes { | ||
if strings.HasPrefix(path, pre) { | ||
cb(path, asset) | ||
} | ||
} | ||
} | ||
//go:embed layouts | ||
var Layouts embed.FS | ||
|
||
//go:embed pages | ||
var Pages embed.FS | ||
|
||
//go:embed partials | ||
var Partials embed.FS | ||
|
||
//go:embed static | ||
var Static embed.FS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ import ( | |
|
||
//go:embed version.txt | ||
var Version string | ||
|
||
const Name = "gonic" | ||
const NameUpper = "GONIC" |