Skip to content

postcss configurability #8

@ctalkington

Description

@ctalkington

i've been going back and forth with a way to use grunt configs to fine tune the options of each postcss processor as the way it works now it can only be configured via functions and if i were to say want to change the rootValue for pxtorem (or disable for specific project), I have to do the following in my gruntfile.

function setPostCSSProcessors() {
    var parr = [];
    var plugins = grunt.config('postcss.options.plugins') || {};

    Object.keys(plugins).forEach(function(plugin) {
      if (plugins[plugin]) {
        var pluginFunc = require(plugin) || false;

        if (pluginFunc) {
          parr.push(pluginFunc(plugins[plugin] || {}));
        }
      }
    });

    grunt.config.set('postcss.options.processors', parr);
  };

  setPostCSSProcessors()

it would be possible to support something globally if load-project-config allowed passing options to load-grunt-config as theres postProcess option which would allow inherit and override as we get with other tasks but convert it to a processors array JIT

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions