Hugo's insanely long build time with PostCSS + Plugins

Hi. I didn’t know which forum section to share this in.

$  ./p                      
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
Fast-forward
 postcss.config.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

                   |  EN   
-------------------+-------
  Pages            |  122  
  Paginator pages  |    0  
  Non-page files   |   29  
  Static files     | 1546  
  Processed images |    0  
  Aliases          |  104  
  Sitemaps         |    1  
  Cleaned          |    0  

Total in 32888 ms

I didn’t know where to post this, but perhaps features? Would or could it be one day possible to port such CSS pre processors in go for Hugo?

It’s not even much that I’m running.

module.exports = {
  plugins: {
      autoprefixer: {},
      cssnano: {preset: 'default'},
	  'postcss-uncss': {
		  html: [
			  './themes/hugo-universal-theme/layouts/**/*.html'
		],
		  ignore: [
			'nav',
			".fade",
			".fade.in",
			".collapse",
			".collapse.in",
			".collapsing",
			/\.open/,
			/\.dropdown/,
			/\.navbar/,
			'.back-to-top-link',
			'#post-content',
			'.navbar-affixed-top',
			'.affix-top'
		]
	}
  }
};

:slight_smile:

But it makes for a ridiculously fast site! So the build time is worth it!

https://gtmetrix.com/compare/Flp3h75C/tbFVje3B

There were other optimizations than just UnCSS.

I wish Hugo did all this very fastly instead of having to rely upon node and modules.

Edit: Or maybe because I’m globbing all the .html files instead of the ones in actual use. Hmm. Could be something there to improve it.