pascalduez / postcss-apply

PostCSS plugin enabling custom properties sets references
The Unlicense
165 stars 12 forks source link

Allow an options set to be a string as well as an object #39

Closed albertstill closed 6 years ago

albertstill commented 6 years ago

Hi. I wanted to be able to support more complex set option definitions at my company. For example:

{
  sets: {
    'font-h1': `
      font-size: var(--h1-mobile-font-size);
      line-height: var(--h1-mobile-line-height);

      @media (--tablet-min-width) {
        font-size: var(--h1-font-size);
        line-height: var(--h1-line-height);
      }
    `,
    'a-normalize': `
      color: inherit;
      text-decoration: inherit;

      &:hover,
      &:focus,
      &:visited,
      &:active {
        color: inherit;
        text-decoration: inherit;
      }
    `,
  }
}

I see this is supported in the consumers style sheet:

screen shot 2018-03-02 at 12 11 48 pm

The code does a type check on the set and passes a string to Root#prepend instead.

codecov-io commented 6 years ago

Codecov Report

Merging #39 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #39   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines          67     72    +5     
=====================================
+ Hits           67     72    +5
Impacted Files Coverage Δ
src/visitor.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8aec327...cd921ec. Read the comment docs.

pascalduez commented 6 years ago

postcss-apply@0.9.0