assetmin

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 17 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 NewAssetMin added in v0.0.5

func NewAssetMin(config *Config) *AssetMin

func (*AssetMin) EnsureOutputDirectoryExists added in v0.0.5

func (c *AssetMin) EnsureOutputDirectoryExists()

crea el directorio de salida si no existe

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

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

Jump to

Keyboard shortcuts

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