kakawait / hugo-tranquilpeak-theme

A gorgeous responsive theme for Hugo blog framework
https://tranquilpeak.kakawait.com
GNU General Public License v3.0
918 stars 527 forks source link

Add support for Hugo pipe SCSS #480

Open kakawait opened 2 years ago

kakawait commented 2 years ago

To get ride of npm/grunt

That will help to customize theme

https://gohugo.io/hugo-pipes/scss-sass/

moomop commented 2 years ago

Making the following change in layouts/partials/head.html allowed me to use the pipeline:

-    <link rel="stylesheet" href="{{ "css/style-2w2urpokyukbsouppglitcyxngrsa0pcm58rrm5mqo3ieqo6bkvr3cz9nvf.min.css" | absURL }}" />
+    {{ $sass := resources.Get "scss/tranquilpeak.scss" }}
+    {{ $style := $sass | resources.ToCSS }}
+    <link rel="stylesheet" href="{{$style.Permalink}}" />
kakawait commented 2 years ago

Making the following change in layouts/partials/head.html allowed me to use the pipeline:

-    <link rel="stylesheet" href="{{ "css/style-2w2urpokyukbsouppglitcyxngrsa0pcm58rrm5mqo3ieqo6bkvr3cz9nvf.min.css" | absURL }}" />
+    {{ $sass := resources.Get "scss/tranquilpeak.scss" }}
+    {{ $style := $sass | resources.ToCSS }}
+    <link rel="stylesheet" href="{{$style.Permalink}}" />

Good know. Looks like simple. I didn't yet invest time on it.

So your feedback is really helpful

moomop commented 2 years ago

Ah! We remembered that when using the SCSS pipeline I also ran into the issue described at https://discourse.gohugo.io/t/cant-use-sass-math-div/33087 It seems uses of math.div added in "Fix embed fontawesome css usage and migrate to dart sass" aren't currently supported by the version of dart used by hugo. I had to change those back to using "/" at least until the version of dart used by hugo is updated. Apart from that I think it was straightforward

kakawait commented 2 years ago

Ah! We remembered that when using the SCSS pipeline I also ran into the issue described at https://discourse.gohugo.io/t/cant-use-sass-math-div/33087 It seems uses of math.div added in "Fix embed fontawesome css usage and migrate to dart sass" aren't currently supported by the version of dart used by hugo. I had to change those back to using "/" at least until the version of dart used by hugo is updated. Apart from that I think it was straightforward

I've to check regarding that recent change https://github.com/kakawait/hugo-tranquilpeak-theme/commit/c4d494feb34be4f4076db57c1d0f7fb97cb2813a

I've upgrade to Dart-sass (because node-sass is painfull as possible) and there is thing related Math div

https://github.com/kakawait/hugo-tranquilpeak-theme/commit/c4d494feb34be4f4076db57c1d0f7fb97cb2813a#diff-7e8c600b2976ebb86830a731229e0127a33c9d0f75786380bc31f18942066897

jehoshua7 commented 2 years ago

@kakawait - Will this enhancement make the use of NPM an option ?

kakawait commented 2 years ago

Yes is the goal