ovhemert/gatsby-plugin-zopfli

Not creating compressed files

Closed this issue · 2 comments

detj commented

I can't seem to get this to work. npm installed the gatsby-plugin-zopfli package with --save. Added gatsby-plugin-zopfli in gatsby-config.js. Then ran gatsby build but it does not generate any .gz files for me. Do note, I have plenty of .js and .css in the public directory.

I also logged on line no 45 in src/zopfli-plugin.in to debug further.

function onPostBuild (args, pluginOptions) {

  console.log('assetsCompress', assetsCompress)

  const compress = Object.keys(assetsCompress).map(file => {
    return compressFile(file)
  })
  return Promise.all(compress)
}

And noticed that assetsCompress is {} for me. Not sure why it would be an empty object when there are assets files.

What am I missing here?

Did you place the plugin as the last one in gatsby-config.js?
Other css and js processing needs to be done first in order for this plugin to pick them up.

detj commented

Shucks! Totally forgot about that. You're right. Closing. Thanks.