I’m trying to get started with Hugo Modules and, while I think I’m close, I’m not there yet. I’ll wager there are others in the same boat. Employing Modules in order to make use of Bootstrap .scss files seems like a very practical and widely applicable place to start. Here’s my setup (and then the errors i’m hitting).
// Configuration
@import "functions";
@import "variables";
@import "mixins";
@import "utilities";
// Layout & components
@import "root";
@import "reboot";
@import "type";
// etc. etc. etc.
And here’s the error message I keep hitting:
Transformation failed: SCSS processing failed: file "…assets/scss/customize-bootstrap/includes.scss": File to import not found or unreadable: functions.
I’m probably wrong, but i think the main problem is that i don’t know how to properly locate the mounted .scss files with my @import calls. I’ve tried loads of different ways:
@import/assets/scss/vendor/bootstrap/functions
@importassets/scss/vendor/bootstrap/functions
@importvendor/bootstrap/functions
@importfunctions
@import_functions.scss
etc.
I’d love to get this working and i’m sure others would benefit from a real-world example, too. Thank you for any thoughts and input.
Locating the files is not the issue. I can perform the imports without any problem if I just download the .scss files. Somehow, they’re just not available for me via Hugo Modules.
bep, I feel like a jerk that i haven’t replied here yet. It was really kind of you to put this together. At the time you posted, I was traveling. And then shortly after the world fell apart (my wife and I launched a new school this year for the children in our community; it’s been a wild ride trying to support our students remotely). In any case, i’m really sorry it’s taken this long to get back to this discussion.
I think my problem is that i’m still missing some fundamental understanding of Hugo modules.
Run this command: hugo mod init github.com/gohugoio/hugo-bootstrap-scss-v4
Which created a file called go.mod which includes this:
module github.com/gohugoio/hugo-bootstrap-scss-v4
go 1.14
Included in my directory structure is: assets > scss > bootstrap
I am running Hugo version 0.69.2/extended and Go version 1.14.2.
When I run the server, I get an error like this:
Error: Error building site: TOCSS: failed to transform "scss/main.scss" (text/x-scss): SCSS processing failed: file "...assets/scss/bootstrap-includes.scss", line 2, col 1: File to import not found or unreadable: bootstrap/functions.
bootstrap/functions is, of course, the first of many Bootstrap SCSS files I am attempting to import.
Error: module "github.com/gohugoio/hugo-bootstrap-scss-v4" not found; either add it as a Hugo Module or store it in "[themes directory]".: module does not exist
I may me mistaken in making this change, but since it’s a deviation from what’s specified in the README.md file, I thought it worth mentioning.
I assume that is from the README. I must admit that I don’t follow the release cycle of Bootstrap, but I do accept pull requests with version updates. Then I can tag it appropriately.
I must admit that the workflow for Hugo Modules lacks some refinement …