assetmin

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 16 Imported by: 2

README

assetmin

web file packager and minifier

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileWrite

func FileWrite(pathFile string, data bytes.Buffer) error

pathFile ej: "theme/index.html" data ej: *bytes.Buffer NOTA: la data del buf sera eliminada después de escribir el archivo

Types

type AssetMin

type AssetMin struct {
	*Config

	WriteOnDisk bool // Indica si se debe escribir en disco
	// contains filtered or unexported fields
}

func NewAssetMinify added in v0.0.3

func NewAssetMinify(config *Config) *AssetMin

func (*AssetMin) NewFileEvent

func (c *AssetMin) NewFileEvent(fileName, extension, filePath, event string) error

event: create, remove, write, rename

func (*AssetMin) UnobservedFiles

func (c *AssetMin) UnobservedFiles() []string

func (*AssetMin) UpdateFileContentInMemory

func (c *AssetMin) UpdateFileContentInMemory(filePath, extension, event string, content []byte) (*fileHandler, error)

type Config added in v0.0.3

type Config struct {
	ThemeFolder               func() string          // eg: web/theme
	WebFilesFolder            func() string          // eg: web/static, web/public, web/assets
	Print                     func(messages ...any)  // eg: fmt.Println
	JavascriptForInitializing func() (string, error) // javascript code to initialize the wasm or other handlers
}

type TestEnvironment added in v0.0.3

type TestEnvironment struct {
	BaseDir       string
	ThemeDir      string
	PublicDir     string
	ModulesDir    string
	MainJsPath    string
	StyleCssPath  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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL