我正在使用 Hugo 构建一个网页。
\n\n这是我的网站标题:
\n\n<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Website</title>\n <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0" /> -->\n <meta name="referrer" content="no-referrer" />\n <link rel="icon" href="/img/favicon.ico" type="image/x-icon" />\n <link\n rel="stylesheet"\n href="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/tiny-slider.css"\n />\n\n <!-- tried this as per suggestion from Hugo forums\n {{ $sassIncludes := (slice "node_modules" "assets/scss/vendor" "assets/scss/components") }}\n {{ $target := "styles/main.css" }}\n {{ if .Site.IsServer }}\n {{ $cssOpts := (dict "targetPath" $target "enableSourceMap" true "includePaths" $sassIncludes ) }}\n {{ $styles := resources.Get "/css/main.scss" | toCSS $cssOpts }}\n <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">\n {{ else }}\n {{ $cssOpts := (dict "targetPath" $target "includePaths" $sassIncludes ) }}\n {{ $styles := resources.Get "/css/main.scss" | toCSS $cssOpts | postCSS | minify | fingerprint }}\n <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">\n {{ end }} -->\n\n {{ $style := resources.Get "/css/main.scss" | resources.ToCSS | minify | fingerprint}}\n\n <link rel="stylesheet" href="{{ $style.RelPermalink }}"/>\n </head>\n\n <body>\n <header>\n <div class="nav-bar">\n <a class="top-logo" href="/">\n <img src="/img/logo.svg" />\n </a>\n </header>\n </body>\n</html>\nRun Code Online (Sandbox Code Playgroud)\n\n这是main.scss:
\n\n@import \'reset\';\n@import \'commonStyles\';\n@import \'pricing\';\n@import \'docs\';\n@import \'header\';\n@import \'footer\';\n@import \'home\';\n\nheader {\n .nav-bar {\n background-color: red;\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n配置.toml:
\n\nbaseURL = "http://example.org/"\nlanguageCode = "en-us"\ntitle = "Website"\nassetDir = "static"\nRun Code Online (Sandbox Code Playgroud)\n\n我正在 macOS 上使用hugo server命令运行。我正在更改样式中的背景颜色。这是终端输出:
thatsme/../website-landing (master\xe2\x86\x911|\xe2\x9c\x9a7\xe2\x80\xa6) % hugo server \nBuilding sites \xe2\x80\xa6 WARN 2020/05/18 12:27:34 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.\nWARN 2020/05/18 12:27:34 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.\n\n | EN \n-------------------+-----\n Pages | 14 \n Paginator pages | 0 \n Non-page files | 0 \n Static files | 19 \n Processed images | 0 \n Aliases | 0 \n Sitemaps | 1 \n Cleaned | 0 \n\nBuilt in 17 ms\nWatching for changes in /Users/thatsme/git/website-landing/{archetypes,content,data,layouts,static}\nWatching for config changes in /Users/thatsme/git/website-landing/config.toml\nEnvironment: "development"\nServing pages from memory\nRunning in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender\nWeb Server is available at http://localhost:1313/ (bind address 127.0.0.1)\nPress Ctrl+C to stop\n\nChange of Static files detected, rebuilding site.\n2020-05-18 12:27:42.202 +0200\nSyncing css/main.scss to /\nRun Code Online (Sandbox Code Playgroud)\n\n仅当我重新启动服务器时,样式更改才适用。Html 更改已得到正确应用。
\n小智 1
以下命令应该可以解决问题:
hugo serve --noHTTPCache --ignoreCache --disableFastRender
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2474 次 |
| 最近记录: |