Module vweb.assets stdlib

vweb.assets
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
3
Imported by:
0
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

Imported by

This section is empty.

Aliases

This section is empty.

Constants

This section is empty.

Sum types

This section is empty.

Functions

#fn minify_css

fn minify_css(css string) string

todo: implement proper minification

#fn minify_js

fn minify_js(js string) string

todo: implement proper minification

#fn new_manager

fn new_manager() &AssetManager

new_manager returns a new AssetManager

Structs

#struct AssetManager

pub struct AssetManager {
mut:
	css []Asset
	js  []Asset
pub mut:
	// when true assets will be minified
	minify bool
	// the directory to store the cached/combined files
	cache_dir string
}

#fn (&AssetManager) add_css

fn (mut am &AssetManager) add_css(file string) bool

add_css adds a css asset

#fn (&AssetManager) add_css_as

fn (mut am &AssetManager) add_css_as(file string, href string) bool

add_css_as adds a css asset with a custom href

#fn (&AssetManager) add_js

fn (mut am &AssetManager) add_js(file string) bool

add_js adds a js asset

#fn (&AssetManager) add_js_as

fn (mut am &AssetManager) add_js_as(file string, src string) bool

add_js_as adds a js asset with a custom src

#fn (AssetManager) combine_css

fn (am AssetManager) combine_css(to_file bool) string

combine_css returns the combined css as a string when to_file is false when to_file is true it combines the css to disk and returns the path of the file

#fn (AssetManager) combine_js

fn (am AssetManager) combine_js(to_file bool) string

combine_js returns the combined js as a string when to_file is false when to_file is true it combines the css to disk and returns the path of the file

#fn (AssetManager) include_css

fn (am AssetManager) include_css(combine bool) string

include_css returns the html tag(s) for including the css files in a page.

when combine is true the files are combined.

#fn (AssetManager) include_js

fn (am AssetManager) include_js(combine bool) string

include_js returns the html