use purgecss with hugo #42
-
Hi, @hugo-sid, Now,I want to use purgecss with hugo to remove unused css(this is my goal), but there is some problem, can you help? My pc is win10 x64, I have installed hugo and I have done something followed the Setup of README.md in the hugo-blog-awesome repo.
Copy Press Ctrl+C to stop. Then I run Then I have tried to use purgecss with hugoWhat I have tried basically refers to the following article:
Fortunately there are no errors,but the size of the file |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
GreetingsHi @jerry011235.
I'm glad you liked this theme. You are most welcome. Probable solutionI have not tried to clone the repo and do all the NPM stuff, but I feel this could be the solution to your problem: You mentioned that, you modified line 15 in {{- $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS (dict "targetPath" "style.css") | postCSS | minify | fingerprint }}
<!--
{{- $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS (dict "targetPath" "style.css") | minify | fingerprint }}
--> Could you remove the following: <!--
{{- $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS (dict "targetPath" "style.css") | minify | fingerprint }}
--> and check whether Purgecss works? ReasoningComments in Go template are marked by |
Beta Was this translation helpful? Give feedback.
-
Hi @hugo-sid. btw, do you know of any better way to reduce the size of this file again? |
Beta Was this translation helpful? Give feedback.
Greetings
Hi @jerry011235.
I'm glad you liked this theme. You are most welcome.
Probable solution
I have not tried to clone the repo and do all the NPM stuff, but I feel this could be the solution to your problem:
You mentioned that, you modified line 15 in
myblog\themes\hugo-blog-awesome\layouts\partials\head.html
to this: