Search code examples
cssreportcss-purge

CSS-PURGE: Config is getting ignored


I try to use CSS-PURGE as system as a service to just notify a user if something could have been done better in his or her CSS. Thus I want CSS-PURGE to give me a report, which should work with the following configuration:

{
  "options": {
    "generate_report": true,
    "report_file_location": "purged_css_report_data.json"
  }
}

I saved this code in a config_css.json and placed it in the project document root. Then, from the same directory, I used the following test command:

css-purge -d -c ".color { color: #ffffff; color: #ff0000; }"

The -d parameter is described in the documentation:

-d: run with the default config file (config_css.json must exist in folder)

I also tried the -f parameter with both relative and absolute path:

css-purge -f "config_css.json" -c ".color { color: #ffffff; color: #ff0000; }"
css-purge -f "/path/to/project/config_css.json" -c ".color { color: #ffffff; color: #ff0000; }“

However, there is no generated report and when I add additional options to the config JSON they don’t affect the execution. It looks like the config is not being loaded.

Am I doing something wrong here to don’t get CSS-PURGE generating a report or might there something be broken on their end?


Solution

  • I finally made it and it was pretty easy:

    As long as there is a -c param no configuration file is processed. As soon as I removed that param and add the path to a CSS file inside the configuration file it worked fine.