Hugo + Netlify, building CSS file I don't want

Hello,

I’m trying to troubleshoot an issue I’m having with my site deployment and I think it has to do with the Hugo build but I’m not sure…

Here is the site name: cranky-pare-844ecb.netlify.app

When I deploy the site it builds fine, but when I go to the preview the CSS is incorrect; it’s using a different CSS file than what is in my Github repo. Here is the build log:

2:44:09 PM: Build ready to start
2:44:11 PM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302
2:44:11 PM: build-image tag: v3.7.6
2:44:11 PM: buildbot version: 77f6cd099df893d1381a2962ebcc1926e092a904
2:44:11 PM: Fetching cached dependencies
2:44:11 PM: Starting to download cache of 97.2MB
2:44:12 PM: Finished downloading cache in 755.631943ms
2:44:12 PM: Starting to extract cache
2:44:15 PM: Finished extracting cache in 2.564240687s
2:44:15 PM: Finished fetching cache in 3.345502215s
2:44:15 PM: Starting to prepare the repo for build
2:44:15 PM: Preparing Git Reference refs/heads/develop
2:44:16 PM: Parsing package.json dependencies
2:44:16 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'hugo --gc --minify -t hugo-swift-theme' versus 'hugo -t hugo-swift-theme' in the Netlify UI
2:44:16 PM: Starting build script
2:44:16 PM: Installing dependencies
2:44:16 PM: Python version set to 2.7
2:44:17 PM: Started restoring cached node version
2:44:19 PM: Finished restoring cached node version
2:44:20 PM: v12.18.0 is already installed.
2:44:21 PM: Now using node v12.18.0 (npm v6.14.4)
2:44:21 PM: Started restoring cached build plugins
2:44:21 PM: Finished restoring cached build plugins
2:44:21 PM: Attempting ruby version 2.7.1, read from environment
2:44:22 PM: Using ruby version 2.7.1
2:44:23 PM: Using PHP version 5.6
2:44:23 PM: Installing Hugo 0.83.1
2:44:23 PM: hugo v0.83.1-5AFE0A57+extended linux/amd64 BuildDate=2021-05-02T14:38:05Z VendorInfo=gohugoio
2:44:23 PM: Started restoring cached go cache
2:44:23 PM: Finished restoring cached go cache
2:44:23 PM: go version go1.14.4 linux/amd64
2:44:23 PM: go version go1.14.4 linux/amd64
2:44:23 PM: Installing missing commands
2:44:23 PM: Verify run directory
2:44:23 PM: ​
2:44:23 PM: ────────────────────────────────────────────────────────────────
2:44:23 PM:   Netlify Build                                                 
2:44:23 PM: ────────────────────────────────────────────────────────────────
2:44:23 PM: ​
2:44:23 PM: ❯ Version
2:44:23 PM:   @netlify/build 12.2.0
2:44:23 PM: ​
2:44:23 PM: ❯ Flags
2:44:23 PM:   deployId: 60c8f4f97e11cf000895aaf7
2:44:23 PM: ​
2:44:23 PM: ❯ Current directory
2:44:23 PM:   /opt/build/repo
2:44:23 PM: ​
2:44:23 PM: ❯ Config file
2:44:23 PM:   /opt/build/repo/netlify.toml
2:44:23 PM: ​
2:44:23 PM: ❯ Context
2:44:23 PM:   production
2:44:23 PM: ​
2:44:23 PM: ────────────────────────────────────────────────────────────────
2:44:23 PM:   1. build.command from netlify.toml                            
2:44:23 PM: ────────────────────────────────────────────────────────────────
2:44:23 PM: ​
2:44:23 PM: $ hugo --gc --minify -t hugo-swift-theme
2:44:23 PM: Start building sites …
2:44:23 PM:                    | EN
2:44:23 PM: -------------------+-----
2:44:23 PM:   Pages            | 20
2:44:23 PM:   Paginator pages  |  0
2:44:23 PM:   Non-page files   |  0
2:44:23 PM:   Static files     | 45
2:44:23 PM:   Processed images |  0
2:44:23 PM:   Aliases          |  8
2:44:23 PM:   Sitemaps         |  1
2:44:23 PM:   Cleaned          |  0
2:44:23 PM: Total in 102 ms
2:44:23 PM: ​
2:44:23 PM: (build.command completed in 145ms)
2:44:23 PM: ​
2:44:23 PM: ────────────────────────────────────────────────────────────────
2:44:23 PM:   2. Deploy site                                                
2:44:23 PM: ────────────────────────────────────────────────────────────────
2:44:24 PM: Creating deploy upload records
2:44:23 PM: ​
2:44:24 PM: Starting to deploy site from 'public'
2:44:24 PM: Creating deploy tree 
2:44:24 PM: 0 new files to upload
2:44:24 PM: 0 new functions to upload
2:44:24 PM: Site deploy was successfully initiated
2:44:24 PM: ​
2:44:24 PM: (Deploy site completed in 141ms)
2:44:24 PM: ​
2:44:24 PM: ────────────────────────────────────────────────────────────────
2:44:24 PM:   Netlify Build Complete                                        
2:44:24 PM: ────────────────────────────────────────────────────────────────
2:44:24 PM: ​
2:44:24 PM: (Netlify Build completed in 349ms)
2:44:24 PM: Starting post processing
2:44:24 PM: Post processing - HTML
2:44:24 PM: Caching artifacts
2:44:24 PM: Started saving build plugins
2:44:24 PM: Finished saving build plugins
2:44:24 PM: Started saving pip cache
2:44:24 PM: Post processing - header rules
2:44:24 PM: Finished saving pip cache
2:44:24 PM: Started saving emacs cask dependencies
2:44:24 PM: Post processing - redirect rules
2:44:24 PM: Finished saving emacs cask dependencies
2:44:24 PM: Started saving maven dependencies
2:44:24 PM: Finished saving maven dependencies
2:44:24 PM: Started saving boot dependencies
2:44:24 PM: Post processing done
2:44:24 PM: Finished saving boot dependencies
2:44:24 PM: Started saving rust rustup cache
2:44:24 PM: Finished saving rust rustup cache
2:44:24 PM: Started saving go dependencies
2:44:24 PM: Finished saving go dependencies
2:44:24 PM: Build script success
2:44:24 PM: Site is live ✨

And here are the build settings:
image

When I go to the site (drewon.top - custom DNS) The CSS is wrong. So if Inspect the site and looks at the elements, I see that the CSS file being used is /css/styles.c445c1b6fe90e200....css. However, the only CSS file in my repo is /css/styles.8a08fc5c24960d03....css.

Building locally using the same version of Hugo and the same command works fine and there is only 1 (correct) CSS file in the /public/css folder (which is of course what gets pushed to Github). So it seems to me that there is something about the Netlify Hugo build that I’m not understanding where it’s building a new CSS file (with the wrong code) instead of using the CSS file in my /public folder. My guess is it’s something about the theme that’s doing this possibly? The theme uses Sass if that helps.

Please let me know what further info you need to help troubleshoot.

Thanks!

Hi @henaege,

I’m not sure what you’re trying to do. You’re uploading a pre-built website to Netlify? If yes, you should get rid of the build command. Currently I can only see 1 CSS file loading in the Network panel for your domain. So, I’m not sure what your issue is exactly.

That’s all I can say for now without actually seeing the repo.

Legend! Removing the build command did the trick!

Thanks for the quick support!