@reading-room/primer-utils
v1.2.1
Published
Primer utils
Downloads
7
Readme
primer-utils
primer-utils is a collection of utility js and scss functions. They are built to work with the Primer framework but can be used independently.
Prerequisites
This project requires Node.js v20.15.0 or higher.
This project requires sass v1.79.2 or higher.
Installation
To install the project, run the following command:
npm install @reading-room/primer-utils
Usage
javascript
To use the utils, import the functions you need from the package:
import { replaceUrlParameter, updateUrlParameter } from '@reading-room/primer-utils';
// Use the functions
const newUrl = replaceUrlParameter('http://example.com?foo=bar', 'foo', 'baz');
console.log(newUrl); // http://example.com?foo=baz
scss
To use the scss functions, import the functions you need from the package:
@use '@reading-room/primer-utils/scss' as utils;
// Use the functions
.some-class {
font-size: utils.px2rem(16);
}
Testing
To run the tests, run the following command:
npm test