Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.
/ px2rem Public archive

Converts #px to #rem values in a CSS file given a root font size.

License

Notifications You must be signed in to change notification settings

sumtype/px2rem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

px2rem

Converts px to rem values in a specified file, given a root font size.

Usage

$python3 px2rem.py [file path] [root font size]

Outputs the contents of the file at [file path] with px values converted to rem values inside the file "output.txt" found in the root directory of this project. Ignores @media query lines leaving anything specified in px inside the same.

[file path]

Any file of any type (CSS, SASS, SCSS, et cetera).

[root font size]

The root font size, which all rem values are calculated relative to (integer or float value in px units). No need to add the "px" suffix to the value, for example, "16" is fine, no need to specify "16px".

Example

$python3 px2rem.py ~/file.css 16

Takes file.css and converts all the px values specified inside to rem values corresponding to a root font size of 16px. So if there's a line in file.css with the value 16px it will be converted to 1.000rem, 8px would be converted to 0.500rem, and so on.

About

Converts #px to #rem values in a CSS file given a root font size.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages