Skip to content

vweb.assets #

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

struct AssetManager #

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