Combine style.css with theme's sytle.css

I have a CSS file in my project (/static/style.css) and the theme I am using also a sytlesheet (it has the same name /static/style.css.

  • I want to combine this two CSS file into one.
  • I also want it to remove duplicate rules.

To combine the files, move them to the assets folder and bundle them together. As for removinng duplicate styles., I am not sure if CSS pruning will help you, since it is mostly intended for CSS frameworks.

At first you need move css files into asserts folder just like @tut said. then could use the slice function append all css file and use resources.Connect function to combine them in one sytle file what you want.

Here for example kind like combine JS files: hugo-next/hugo-theme-next/layouts/partials/scripts.html

Hope it can help you.

Actually, you have no need to do this. CSS means ‘cascading style sheet’, and its size is usually mini.

If you still want to do that you describled. Maybe a better way is that append your style.css to the site’s. Like @import "path/to/your-style.css" .