1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: example: make css in vweb_assets.v work (#8090)

This commit is contained in:
Hitalo de Jesus do Rosário Souza 2021-01-30 10:20:13 -03:00 committed by GitHub
parent 7e3b3a9efc
commit 8dff63b824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<html>
<header>
<title>@title</title>
@css
@css 'examples/vweb/vweb_assets/assets/index.css'
</header>
<body>
<h1>@title</h1>

View File

@ -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.'