JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5834489
  • Score
    100M100P100Q246909F
  • License CC0-1.0

Use the :any-link pseudo-class in CSS

Package Exports

  • postcss-pseudo-class-any-link

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-pseudo-class-any-link) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostCSS Pseudo Class Any Link PostCSS Logo

NPM Version CSS Standard Status Build Status Windows Build Status Support Chat

PostCSS Pseudo Class Any Link lets you :any-link pseudo-class in CSS, following the Selectors specification.

nav :any-link > span {
  background-color: yellow;
}

/* becomes */

nav :link > span, nav :visited > span {
  background-color: yellow;
}

nav :any-link > span {
  background-color: yellow;
}

From the proposal:

The :any-link pseudo-class represents an element that acts as the source anchor of a hyperlink. It matches an element if the element would match :link or :visited.

Usage

Add PostCSS Pseudo Class Any Link to your build tool:

npm install postcss-pseudo-class-any-link --save-dev

Node

Use PostCSS Pseudo Class Any Link to process your CSS:

import postcssPseudoClassAnyLink from 'postcss-pseudo-class-any-link';

postcssPseudoClassAnyLink.process(YOUR_CSS, /* processOptions */, /* pluginOptions */);

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Use PostCSS Pseudo Class Any Link as a plugin:

import postcss from 'gulp-postcss';
import postcssPseudoClassAnyLink from 'postcss-pseudo-class-any-link';

postcss([
  postcssPseudoClassAnyLink(/* pluginOptions */)
]).process(YOUR_CSS);

Webpack

Add PostCSS Loader to your build tool:

npm install postcss-loader --save-dev

Use PostCSS Pseudo Class Any Link in your Webpack configuration:

import postcssPseudoClassAnyLink from 'postcss-pseudo-class-any-link';

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          'style-loader',
          { loader: 'css-loader', options: { importLoaders: 1 } },
          { loader: 'postcss-loader', options: {
            ident: 'postcss',
            plugins: () => [
              postcssPseudoClassAnyLink(/* pluginOptions */)
            ]
          } }
        ]
      }
    ]
  }
}

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Use PostCSS Pseudo Class Any Link in your Gulpfile:

import postcss from 'gulp-postcss';
import postcssPseudoClassAnyLink from 'postcss-pseudo-class-any-link';

gulp.task('css', () => gulp.src('./src/*.css').pipe(
  postcss([
    postcssPseudoClassAnyLink(/* pluginOptions */)
  ])
).pipe(
  gulp.dest('.')
));

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Use PostCSS Pseudo Class Any Link in your Gruntfile:

import postcssPseudoClassAnyLink from 'postcss-pseudo-class-any-link';

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
  postcss: {
    options: {
      use: [
       postcssPseudoClassAnyLink(/* pluginOptions */)
      ]
    },
    dist: {
      src: '*.css'
    }
  }
});

Options

preserve

The preserve option determines whether the original :any-link rule is preserved. By default, it is preserved.

postcssPseudoClassAnyLink({ preserve: false })
nav :any-link > span {
  background-color: yellow;
}

/* becomes */

nav :link > span, nav :visited > span {
  background-color: yellow;
}