package ui import "embed" // The below is actually a comment directive. Comment directives must be // placed immediately above the variable used. The path provided is relative // to the .go file it is in. You can only embed on global variables at a package // level. Paths cannot contain . or .. or begin with / So you are effectively // restricted to embedding files within the same directory as the .go file. // You can provide multiple passes "static/css" "static/img" "static/js" to help with // avoiding shipping things like a PostCSS(tailwind) css file. // Can also us static/css/*.css. "all:static" will embed . and _ files too. // Lastly the embedded file system is always rooted in the directory that contains // the embed directive. So in this example the root is in our ui dir. //go:embed "static" "html" var Files embed.FS