heybokeh/pollen

[v4] Move pollen defaults from config argument to import?

Closed this issue · 1 comments

From #55.

Potentially move Pollen's defaults from an argument provided to a config function, to a seperate import provided in pollen-css/defaults or something, and have pollen.config.js export a plain object instead.

Current implementation

module.exports = (pollen) => ({
  output: './styles/pollen.css',
  modules: {
    radius: { ...pollen.radius, xs: '2px', sm: '4px ' },
  }
});

Proposal

const pollen = require('pollen-css/defaults');

module.exports = {
  output: './styles/pollen.css',
  modules: {
    radius: { ...pollen.radius, xs: '2px', sm: '4px ' },
  }
};

This would be a breaking change and therefore needs to to resolved before shipping a final v4. I'm currently leading towards the former (current impl) as more of a standard pattern, especially since untouched keys (or keys with a value of true) inherit pollen defaults, which I think the current pattern communicates better. But open to arguments on the contrary.

Actually after just documenting this I think the existing approach is the right one to go with. Muddying the package exports with defaults that are only used in this config file seems redundant. And since Pollen's config can take a plain object or function regardless, this can be added later if needed for different use cases (programmatic usage? Dunno).

Closing this for now