Hello,
I cannot figure out how to mount a node_modules package in order to have an import resolved by css.PostCSS when using Hugo 0.165.0. I use tailwindcss 3 and therefore have to stay with css.PostCSS if I understand that part correctly.
[[module.mounts]]
source = "node_modules/maplibre-gl/dist"
target = "assets/maplibre-gl"
hugo config mount looks good:
"mounts": [
{
"source": "assets",
"target": "assets"
},
{
"source": "content",
"target": "content"
},
{
"source": "node_modules/maplibre-gl/dist",
"target": "assets/css/maplibre-gl"
},
But resources.Get "maplibre-gl/maplibre-gl.css" or any resources.GetMatch does not find the file. The goal would be to provide this resource via importContext to css.PostCSS to have it resolved.
The whole ordeal currently looks like this:
{{- $styles := (slice (resources.Get "css/tailwind.css")) -}}
{{- /\* Include styles provided by modules. \*/ -}}
{{- if (reflect.IsMap .) -}}
{{- range $name, $data := .modules -}}
{{- with (index $data "css") -}}
{{ $styles = $styles | append . }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $maplibre := resources.Get "css/maplibre-gl/maplibre-gl.css" -}}
{{ warnf "CSS %s %s" $styles $maplibre }}
{{ if not $maplibre }}
{{ errorf "MAPLIBRE NOT FOUND" }}
{{ end }}
{{- $options := dict "inlineImports" true "skipInlineImportsNotFound" false -}}
{{- $styles = $styles | resources.Concat "css/main.css" | css.PostCSS $options -}}
Am I missing something or is this approach not feasible? Thanks.