Changing Media Type of a ResourceAdapter?

I’m trying to concat two resources a processed SCSS file and a CSS file and get a strange error:

resources in Concat must be of the same Media Type, got "text/css" and "text/x-scss"

Which is quite odd since | toCSS should change a SCSS Resource to a CSS resource. Can I (force) update the mediatype somehow (like {{- resources.SetMediaType $scssStyle "text/css" -}})?

Or is the processor just forgetting to update the media type?

Please post a longer excerpt of your code. The “Which is quite odd since | toCSS should change a SCSS Resource to a CSS resource.” points to you using it somewhere, so show where and we might gain more insight.

There is no setmediatype functionality available and the error points to the rsource being SCSS and not compiled CSS. The problem is further up the processing-chain in your layout.

{{ $r_sass := resources.Get "a.scss" | toCSS }}
{{ warnf "$r_sass.MediaType = %s" $r_sass.MediaType}}

{{ $r_css := resources.Get "b.css" }}
{{ warnf "$r_css.MediaType = %s" $r_css.MediaType}}

{{ $r_combined := slice $r_sass $r_css | resources.Concat "combined.css" | minify | fingerprint "sha512" }}
{{ warnf "$r_combined.MediaType = %s" $r_combined.MediaType}}

<link rel="stylesheet" href="{{ $r_combined.RelPermalink }}" integrity="{{ $r_combined.Data.Integrity }}" >
1 Like