vweb: example: make css in vweb_assets.v work (#8090)
							parent
							
								
									7e3b3a9efc
								
							
						
					
					
						commit
						8dff63b824
					
				|  | @ -1,7 +1,7 @@ | |||
| <html> | ||||
| <header> | ||||
| 	<title>@title</title> | ||||
| 	@css | ||||
| 	@css 'examples/vweb/vweb_assets/assets/index.css' | ||||
| </header> | ||||
| <body> | ||||
| 	<h1>@title</h1> | ||||
|  |  | |||
|  | @ -20,10 +20,10 @@ pub fn (mut app App) init_once() { | |||
| 	// Arbitary mime type.
 | ||||
| 	app.serve_static('/favicon.ico', 'favicon.ico', 'img/x-icon') | ||||
| 	// Automatically make available known static mime types found in given directory.
 | ||||
| 	app.handle_static('assets') | ||||
| 	// app.handle_static('assets')
 | ||||
| 	// This would make available all known static mime types from current
 | ||||
| 	// directory and below.
 | ||||
| 	// app.vweb.handle_static('.')
 | ||||
| 	app.handle_static('.') | ||||
| } | ||||
| 
 | ||||
| pub fn (mut app App) init() { | ||||
|  | @ -31,9 +31,9 @@ pub fn (mut app App) init() { | |||
| 
 | ||||
| pub fn (mut app App) index() vweb.Result { | ||||
| 	// We can dynamically specify which assets are to be used in template.
 | ||||
| 	mut am := assets.new_manager() | ||||
| 	am.add_css('assets/index.css') | ||||
| 	css := am.include_css(false) | ||||
| 	// 	mut am := assets.new_manager()
 | ||||
| 	// 	am.add_css('assets/index.css')
 | ||||
| 	// 	css := am.include_css(false)
 | ||||
| 	title := 'VWeb Assets Example' | ||||
| 	subtitle := 'VWeb can serve static assets too!' | ||||
| 	message := 'It also has an Assets Manager that allows dynamically specifying which CSS and JS files to be used.' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue