pso

postcss-substitute-optional-required

PostCSS plugin to shim the pseudo-selectors :required and :optional by using negation (:not) and therefore increase their browser support.

Showing:

Popularity

Downloads/wk

3

GitHub Stars

1

Maintenance

Last Commit

5yrs ago

Contributors

1

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

PostCSS Substitute Optional Required Build Status [dependencies] (https://david-dm.org/MattDiMu/postcss-substitute-optional-required) devDependencies

I currently recommend you NOT to use this plugin. It's just a POC with few practical use (only for iOS Safari 4.1 and 4.3, which have a very low market share).

PostCSS plugin to shim the pseudo-selectors :required and :optional by using negation (:not) and therefore slightly increase their browser support.

/* input */
input:required::after {
    content: '*'
}
textarea:optional::after {
    content: '(optional)';
}

/* output */
input:not(:optional),
input:required::after {
    content: '*'
}

textarea:not(:required)::after,
textarea:optional::after {
    content: '(optional)';
}
/* input, option { method: 'shim-required' } */
:required {
    color: hotpink;
}
:optional {
    color: indianred;
}
/* output, option { method: 'shim-required' } */
:not(:optional),
:required {
    color: hotpink;
}
:optional {
    color: indianred;
}
/* input, option { method: 'shim-optional' } */
:required {
    color: hotpink;
}
:optional {
    color: indianred;
}
/* output, option { method: 'shim-optional' } */
:required {
    color: hotpink;
}
:not(:required),
:optional {
    color: indianred;
}

##Options The only available option is method, with the possible values shim-all (default), shim-optional and shim-required:

Usage

postcss([ require('postcss-substitute-optional-required') ])
postcss([ require('postcss-substitute-optional-required') ])({ method: 'shim-required' }) //shim only the :required selector

See PostCSS docs for examples for your environment.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial