-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embed static assets using the 'embed' package
- Loading branch information
Showing
4 changed files
with
22 additions
and
23 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 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package main | ||
|
||
import ( | ||
"embed" | ||
"io" | ||
) | ||
|
||
// embeddedAssets holds static web assets | ||
//go:embed assets | ||
var embeddedAssets embed.FS | ||
|
||
func Asset(name string) ([]byte, error) { | ||
f, err := embeddedAssets.Open(name) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer f.Close() | ||
|
||
return io.ReadAll(f) | ||
} |
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,16 +1,10 @@ | ||
#!/bin/sh | ||
|
||
# This script assumes you've run | ||
# go get -u github.com/jteeuwen/go-bindata/... | ||
# at least once. | ||
|
||
cd bin/journal-server | ||
cd assets | ||
sass --update --style=compressed scss:css | ||
cd .. | ||
go generate | ||
cd ../.. | ||
cd ../../.. | ||
|
||
go build -o jrnl bin/jrnl/*.go | ||
go build -o journal-server bin/journal-server/*.go | ||
exec go build -o journal-server bin/journal-server/*.go | ||
|
This file was deleted.
Oops, something went wrong.