HUGO

Postcss.config.js in theme module

Until now I had my theme as a Hugo module, and all the repos that use it had their own postcss.config.js which is just:

module.exports = {
    plugins: [
        require('autoprefixer')
    ]
};

Seeing the new features introduced in Hugo v0.75 I tried to move the file to my theme removing it from the consumer repos, but haven’t been able so far :confused:

If it’s supposed to work out of the box I can do a min repro; but I suspect that I’m just missing some obvious config, either in my theme or in my consumer repos. Any help would be appreciated :slight_smile:

My postcss.config.js has a little different “bracket-layout” ({}):

module.exports = {
  "plugins": {
    "precss": {},
    "autoprefixer": {
      "flexbox": true
    },
    "pixrem": {},
    "cssnano": {
      "preset": "default"
    }
  }
}

It’s located in the theme module and the plugins and postcss are defined in the themes package.json.

You might want to post the error that is coming up.

1 Like

OMG, that was all! Replacing my postcss.config.js with this one worked like a charm:

module.exports = {
  "plugins": {
    "autoprefixer": {}
  }
};

The only reason I was using the other syntax was because I copied it from the official autoprefixer README.

Dead simple. Thanks a lot for your help! :heart_eyes:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.