Gathering detailed insights and metrics for postcss-helpers
Gathering detailed insights and metrics for postcss-helpers
Gathering detailed insights and metrics for postcss-helpers
Gathering detailed insights and metrics for postcss-helpers
Some general purpose helpers for PostCSS, created to make working with url() and @import values more easy. Can be used without PostCSS.
npm install postcss-helpers
Typescript
Module System
Min. Node Version
Node Version
NPM Version
95.9
Supply Chain
98.1
Quality
75.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
7,346,712
Last Day
401
Last Week
14,439
Last Month
64,746
Last Year
1,275,433
MIT License
1 Stars
26 Commits
1 Watchers
1 Branches
1 Contributors
Updated on May 18, 2023
Minified
Minified + Gzipped
Latest Version
0.3.3
Package Id
postcss-helpers@0.3.3
Unpacked Size
23.95 kB
Size
6.09 kB
File Count
13
NPM Version
8.11.0
Node Version
16.15.1
Published on
May 18, 2023
Cumulative downloads
Total Downloads
Last Day
7.8%
401
Compared to previous day
Last Week
-10.8%
14,439
Compared to previous week
Last Month
-10.6%
64,746
Compared to previous month
Last Year
-20.5%
1,275,433
Compared to previous year
Some general purpose helpers for PostCSS, created to make working with url() and @import values more easy. Can be used without PostCSS.
1npm install postcss-helpers
Returns new UrlsHelper object from the rule string with one or more url() (see description below).
Returns new ImportHelper object from the @import value string (see description below).
Object for manipulating values of rules with one or multiple url().
Returns original rule that it was created with.
Returns Array of all original URI in string. NOT mutated URIs.
Array of one or more urijs objects that can be used for URI manipulations. If there is no url() in the rule returns false.
For example you can use UrlsHelper.URIS[0].href() to get value for the first url() and UrlsHelper.URIS[0].href('new_uri') to set new URI value. See full documentation.
After you finished changing values of the URIS you can get modified rule text with this command.
Object for manipulating values of @import at-rules.
Returns original rule that it was created with.
Returns original URI from string. NOT mutated URI.
urijs objects that can be used for URI manipulations. If there is no url() in the rule returns false.
For example you can use ImportHelper.URI.href() to get import value and ImportHelper.URI.href('new_uri') to set new URI value. See full documentation.
After you finished changing values of the URI you can get modified rule text with this command.
Returns media query from original string.
Replace old media query or creates new one.
Returns current media query from string.
Collection of some useful RegExps based on CSS specification grammar rules: http://www.w3.org/TR/CSS21/grammar.html
Modify string with multiple url() fragments:
1var helpers = require( 'postcss-helpers' ); 2 3var rule = 'url(logo1.png)', url( 'logo2.png' ), url( "logo3.png"); 4 5var helper = helpers.createUrlsHelper( rule ); 6 7helper.URIS.forEach( function( uri ) { 8 uri.suffix( 'jpeg' ); 9} ); 10 11var modifiedRule = helper.getModifiedRule(); // url(logo1.jpeg)', url( 'logo2.jpeg' ), url( "logo3.jpeg")
Modify @import value:
1var helpers = require( 'postcss-helpers' ); 2 3var rule = '"src/print.css" print'; 4 5var helper = helpers.createImportHelper( rule ); 6 7helper.URI.directory( 'dist' ); 8helper.getMediaQuery(); // print 9helper.setMediaQuery( 'screen' ); 10 11var modifiedRule = helper.getModifiedRule(); // "dist/print.css" screen
Test if string contains url() fragments:
1var helpers = require( 'postcss-helpers' ); 2 3var rule = 'url(logo1.png)', url( 'logo2.png' ), url( "logo3.png"); 4 5helpers.regexp.URIS.test( rule ); // true
UrlsHelper() and ImportHelper() will not escape quotes in the new URI values so escape them yourself.
See CHANGELOG for detailed changes.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
7 existing vulnerabilities detected
Details
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More