npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

postcss-pseudo-any

v1.0.1

Published

PostCSS plugin which converts the :any() selector to :-moz-any() and :-webkit-any()

Downloads

81

Readme

postcss-pseudo-any

Build Status Build Status

A PostCSS plugin for CSS authors who can't wait to use :matches() or :is(). Converts the :any() selector to :-moz-any() and :-webkit-any(), and lets you get on with things.

WTF

CSS level 4 contains a spec for :is() which was previously called :matches(), and previous to that was anticipated to be called :any(), and was actually implemented at some point, across most modern browsers in prefixed form as :-moz-any() and :-webkit-any().

Those prefixed forms are now considered deprecated (and slightly wrong in terms of specificity), and they lack some features projected for :is(); but the fact remains that no browser currently implements :is() or :matches(), while prefixed :-moz-any() and :-webkit-any() are well-supported.

Usage

Basically, start with a declaration using an :is(), :matches() or :any() selector:

.bar,
:is(.good),
:matches(.well),
[class^='base-']:any(a),
:any(p, ul, ol),
.foo {
  color: blue
}

This will be cloned and separated out, in to separate declarations with prefixed versions of the is/matches/any selectors isolated from any other selectors in that declaration:

:-moz-any(.good), 
:-moz-any(.well), 
[class^='base-']:-moz-any(a), 
:-moz-any(p, ul, ol) { 
  color: blue 
} 
 
:-webkit-any(.good), 
:-webkit-any(.well), 
[class^='base-']:-webkit-any(a), 
:-webkit-any(p, ul, ol) { 
  color: blue 
} 
 
.bar, 
.foo { 
  color: blue 
} 

Get Started

Installation

If you do not use PostCSS, add it according to official docs and set this plugin in settings; otherwise check your project for an existing PostCSS config: postcss.config.js in the project root, "postcss" section in package.json, or postcss in bundle config, and add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-pseudo-any')(options),
    require('autoprefixer')
  ]
}

Options

|option name|default value|meaning| |--|--|--| |matchModern|true|Whether the plugin should convert :is() and :matches selectors as well as :any()| |matchPrefixed|false|Whether the plugin should convert already prefixed :-moz-any() and :-webkit-any()selectors as well as non-prefixed ones|