Skip to content
This repository was archived by the owner on Jun 6, 2022. It is now read-only.

5.1.0 #39

Merged
merged 1 commit into from
Sep 14, 2018
Merged

5.1.0 #39

merged 1 commit into from
Sep 14, 2018

Conversation

jonathantneal
Copy link
Contributor

  • Added: New exportTo function to specify where to export custom selectors
  • Updated: importFrom option to support passing it a function

exportTo

The exportTo option specifies destinations where custom selectors can be exported to, which might be CSS, JS, and JSON files, functions, and directly passed objects.

postcssCustomSelectors({
  exportTo: 'path/to/file.css' // @custom-selector :--heading h1, h2, h3;
});

Multiple destinations can be passed into this option, and they will be parsed in the order they are received. JavaScript files, JSON files, and objects will need to namespace custom selectors using the customProperties or custom-properties key.

const cachedObject = { customSelectors: {} };

postcssCustomSelectors({
  exportTo: [
    'path/to/file.css',   // @custom-selector :--heading h1, h2, h3;
    'and/then/this.js',   // module.exports = { customSelectors: { ':--heading': 'h1, h2, h3' } }
    'and/then/this.mjs',  // export const customSelectors = { ':--heading': 'h1, h2, h3' } }
    'and/then/that.json', // { "custom-selectors": { ":--heading": "h1, h2, h3" } }
    cachedObject,
    customProperties => {
      customProperties    // { ':--heading': 'h1, h2, h3' }
    }
  ]
});

@jonathantneal jonathantneal force-pushed the release/5.1.0 branch 2 times, most recently from a699c61 to 6b5bacb Compare September 11, 2018 21:28
@jonathantneal jonathantneal merged commit 6380b00 into master Sep 14, 2018
@jonathantneal jonathantneal deleted the release/5.1.0 branch September 14, 2018 01:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant