csssource-mapsbrunchpostcss

Brunch: why it creates sourceMap in production for CSS


I have following configs

package.json

{
  "name": "test",
  "version": "1.0.0",
  "scripts": {
    "start": "brunch watch --server",
    "prod": "rm -rf public/ && brunch build --production"
  },
  "devDependencies": {
    "brunch": "^2.10.12",
    "cssnano": "^3.10.0",
    "postcss-brunch": "^2.1.0"
  }
}

brunch-config.js

module.exports = {
  files: {
    stylesheets: {
      joinTo: 'app.css'
    }
  }
};

And simple CSS file

body {
  background: green;
}

The problem is I want to have sourceMaps for CSS in dev, but not in production. The docs says it's default behaviour, however when I use brunch build --production I still have sourceMaps in the output.


Solution

  • Just in case somebody will need this, here is dirty fix

    package.json

    {
      "scripts": {
        "build": "rm -rf public && brunch build --production && sed -i -r ':a; s%(.*)/\\*.*\\*/%\\1%; ta; /\\/\\*/ !b; N; ba' public/*.css"
      },
    }