So, I managed to figure out a way to use MDC in Hugo.
-
Sass and JS are imported into, say,
index.scss
andindex.js
respectively like the MDC documentation says, and placed inside theassets
folder:. └── assets ├── js | └── index.js └── sass └── index.scss
-
In the HTML layout, bundle the sass and js files:
<!-- inside head --> {{ $sass := resources.Get "sass/index.scss" }} {{ $options := (dict "transpiler" "dartsass" "includePaths" (slice "node_modules")) }} {{ $style := $sass | resources.ToCSS $options }} <link rel="stylesheet" href="{{ $style.Permalink }}" /> . . . <!-- at the end of body --> {{ $js := resources.Get "js/index.js" | js.Build }} <script src="{{ $js.Permalink }}"></script>