Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-prefixer

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-prefixer - npm Package Compare versions

Comparing version 2.1.3 to 3.0.0

.github/workflows/test.yml

26

lib/prefixer.js

@@ -1,2 +0,1 @@

const postcss = require('postcss');
const Tokenizer = require('css-selector-tokenizer');

@@ -49,3 +48,3 @@ const {

const prefixer = (options) => (css) => {
const prefixer = (options) => {
const { prefix, ignore } = Object.assign({}, {

@@ -64,14 +63,19 @@ prefix: '',

if (!prefix.length) return;
return {
postcssPlugin: 'postcss-prefixer',
Once(css) {
if (!prefix.length) return;
css.walkRules((rule) => {
const parsed = Tokenizer.parse(rule.selector);
const selector = interateSelectorNodes(parsed, { prefix, ignore });
css.walkRules((rule) => {
const parsed = Tokenizer.parse(rule.selector);
const selector = interateSelectorNodes(parsed, { prefix, ignore });
/* eslint no-param-reassign: "off" */
rule.selector = Tokenizer.stringify(selector);
});
/* eslint no-param-reassign: "off" */
rule.selector = Tokenizer.stringify(selector);
});
},
};
};
prefixer.postcss = true;
module.exports = postcss.plugin('postcss-prefixer', prefixer);
module.exports = prefixer;
{
"name": "postcss-prefixer",
"version": "2.1.3",
"version": "3.0.0",
"description": "postcss plugin to prefix all css selector classes and ids",
"main": "lib/prefixer.js",
"engines": {
"node": ">=6.0.0"
"node": "^10 || ^12 || >=14"
},
"dependencies": {
"css-selector-tokenizer": "^0.7.2",
"postcss": "^5.2.18"
"css-selector-tokenizer": "^0.7.2"
},
"peerDependencies": {
"postcss": ">= 5.0.0"
"postcss": "^8.0.0"
},

@@ -22,8 +21,8 @@ "devDependencies": {

"husky": "^4.2.3",
"jest": "^24.9.0"
"jest": "^29.5.0",
"postcss": "^8.4.23"
},
"scripts": {
"test": "jest",
"test": "jest --coverage",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"lint": "eslint ./lib",

@@ -30,0 +29,0 @@ "prepublish": "npm run lint && npm test"

# postcss-prefixer
[![Build Status](https://travis-ci.org/marceloucker/postcss-prefixer.svg?branch=master)](https://travis-ci.org/marceloucker/postcss-prefixer) [![dependencies Status](https://david-dm.org/marceloucker/postcss-prefixer/status.svg)](https://david-dm.org/marceloucker/postcss-prefixer) [![devDependencies Status](https://david-dm.org/marceloucker/postcss-prefixer/dev-status.svg)](https://david-dm.org/marceloucker/postcss-prefixer?type=dev)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

@@ -36,3 +35,3 @@

`npm i -D postcss-prefixer` or `yarn add -D postcss-prefixer`
`npm i -D postcss postcss-prefixer` or `yarn add -D postcss postcss-prefixer`

@@ -39,0 +38,0 @@ create a `postcss.config.js` with:

@@ -33,13 +33,11 @@ const fs = require('fs');

test('should throw when passing invalid prefix type', () => {
const results = postcss()
expect(() => postcss()
.use(postcssPrefixer({ prefix: 123, ignore: [] }))
.process(mocks.default.source);
expect(() => results.css).toThrow();
.process(mocks.default.source)).toThrow();
});
test('should throw when passing invalid ignore type', () => {
const results = postcss()
expect(() => postcss()
.use(postcssPrefixer({ prefix: 'prefix-', ignore: '.to-ignore' }))
.process(mocks.default.source);
expect(() => results.css).toThrow();
.process(mocks.default.source)).toThrow();
});

@@ -46,0 +44,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc