Documentation
¶
Index ¶
- func FileWrite(pathFile string, data bytes.Buffer) error
- func NewFaviconSvgHandler(ac *Config, outputName string) *asset
- func NewHtmlHandler(ac *Config, outputName, cssURL, jsURL string) *asset
- func NewSvgHandler(ac *Config, outputName string) *asset
- type AssetMin
- func (c *AssetMin) EnsureOutputDirectoryExists()
- func (c *AssetMin) GetWorkMode() WorkMode
- func (c *AssetMin) NewFileEvent(fileName, extension, filePath, event string) error
- func (c *AssetMin) RefreshAsset(extension string)
- func (c *AssetMin) RegisterRoutes(mux *http.ServeMux)
- func (c *AssetMin) SetWorkMode(mode WorkMode)
- func (c *AssetMin) SupportedExtensions() []string
- func (c *AssetMin) UnobservedFiles() []string
- func (c *AssetMin) UpdateFileContentInMemory(filePath, extension, event string, content []byte) (*asset, error)
- type Config
- type TestEnvironment
- func (env *TestEnvironment) CleanDirectory()
- func (env *TestEnvironment) CreateModulesDir() *TestEnvironment
- func (env *TestEnvironment) CreatePublicDir() *TestEnvironment
- func (env *TestEnvironment) CreateThemeDir() *TestEnvironment
- func (env *TestEnvironment) TestConcurrentFileProcessing(fileExtension string, fileCount int)
- func (env *TestEnvironment) TestFileCRUDOperations(fileExtension string)
- type WorkMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileWrite ¶
pathFile e.g., "theme/htmlMainFileName" data e.g., *bytes.Buffer NOTE: The buffer data will be cleared after writing the file
func NewFaviconSvgHandler ¶ added in v0.0.62
NewFaviconSvgHandler creates a handler for favicon.svg that simply minifies and copies the file without sprite wrapping. This handler processes standalone SVG files like favicon.svg
func NewHtmlHandler ¶ added in v0.0.20
NewHtmlHandler creates an HTML asset handler using the provided output filename
func NewSvgHandler ¶ added in v0.0.19
Types ¶
type AssetMin ¶
type AssetMin struct {
*Config
// contains filtered or unexported fields
}
func NewAssetMin ¶ added in v0.0.5
func (*AssetMin) EnsureOutputDirectoryExists ¶ added in v0.0.5
func (c *AssetMin) EnsureOutputDirectoryExists()
func (*AssetMin) GetWorkMode ¶ added in v0.0.67
GetWorkMode returns the current work mode of AssetMin.
func (*AssetMin) NewFileEvent ¶
event: create, remove, write, rename
func (*AssetMin) RefreshAsset ¶ added in v0.0.66
func (*AssetMin) RegisterRoutes ¶ added in v0.0.67
RegisterRoutes registers the HTTP handlers for all assets.
func (*AssetMin) SetWorkMode ¶ added in v0.0.67
SetWorkMode sets the work mode for AssetMin.
func (*AssetMin) SupportedExtensions ¶ added in v0.0.53
func (*AssetMin) UnobservedFiles ¶
type Config ¶ added in v0.0.3
type Config struct {
OutputDir string // eg: web/static, web/public, web/assets
Logger func(message ...any) // Renamed from io.Writer to a function type
GetRuntimeInitializerJS func() (string, error) // javascript code to initialize the wasm or other handlers
AppName string // Application name for templates (default: "MyApp")
AssetsURLPrefix string // New: for HTTP routes
}
type TestEnvironment ¶ added in v0.0.3
type TestEnvironment struct {
BaseDir string
ThemeDir string
PublicDir string
ModulesDir string
MainJsPath string
MainCssPath string
MainSvgPath string
MainHtmlPath string
AssetsHandler *AssetMin
// contains filtered or unexported fields
}
TestEnvironment holds all the paths and components needed for asset tests
func (*TestEnvironment) CleanDirectory ¶ added in v0.0.3
func (env *TestEnvironment) CleanDirectory()
CleanDirectory removes all content from the test directory but keeps the directory itself
func (*TestEnvironment) CreateModulesDir ¶ added in v0.0.4
func (env *TestEnvironment) CreateModulesDir() *TestEnvironment
CreateModulesDir creates the modules directory if it doesn't exist
func (*TestEnvironment) CreatePublicDir ¶ added in v0.0.4
func (env *TestEnvironment) CreatePublicDir() *TestEnvironment
CreatePublicDir creates the public directory if it doesn't exist
func (*TestEnvironment) CreateThemeDir ¶ added in v0.0.4
func (env *TestEnvironment) CreateThemeDir() *TestEnvironment
CreateThemeDir creates the theme directory if it doesn't exist
func (*TestEnvironment) TestConcurrentFileProcessing ¶ added in v0.0.9
func (env *TestEnvironment) TestConcurrentFileProcessing(fileExtension string, fileCount int)
TestConcurrentFileProcessing is a reusable function to test concurrent file processing for both JS and CSS.
func (*TestEnvironment) TestFileCRUDOperations ¶ added in v0.0.11
func (env *TestEnvironment) TestFileCRUDOperations(fileExtension string)
TestFileCRUDOperations tests the complete CRUD cycle (create, write, remove) for a file