refactor: migrate part of the sass compilation to vite (#283)

* refactor: migrate part of the sass compilation to vite

now `bundled` option is deprecated

* fix: update build script

* chore: add a “type” field to the package.json file to resolve Vite’s complaints about CommonJS modules.
This commit is contained in:
Spedon
2024-02-22 23:44:16 +08:00
committed by GitHub
parent 53a44776de
commit 875113448b
8 changed files with 82 additions and 25 deletions

View File

@@ -7,16 +7,8 @@
{{- $style = dict "Context" . "ToCSS" $options "Inline" true | merge $style -}}
{{- partial "plugin/style.html" $style -}}
{{/* main style */}}
{{- if (site.Params.bundled | default true) -}}
{{- $style := dict "Link" "/bundled/css/style.min.css" "Defer" true -}}
{{- partial "plugin/style.html" $style -}}
{{- else -}}
{{- $style := dict "Source" "scss/style.scss" "Fingerprint" $fingerprint -}}
{{- $options := dict "targetPath" "css/style.css" "enableSourceMap" true "includePaths" (slice "node_modules") -}}
{{- $style = dict "Context" . "ToCSS" $options "Minify" hugo.IsProduction "Defer" true | merge $style -}}
{{- partial "plugin/style.html" $style -}}
{{- end -}}
{{- $style := dict "Link" "/bundled/css/main.css" "Defer" true -}}
{{- partial "plugin/style.html" $style -}}
{{/* fuck safari */}}
<script>