Emifier is a command-line tool that automatically converts pixel (px) measurements to em units in CSS files. This enhances the accessibility, responsiveness, and scalability of your web projects.
1.1.4
Install Emifier via npm:
npm install -g emifier
This will install Emifier globally on your system, making it available in your command line.
To use Emifier, run the emify
command followed by optional arguments for base pixel size and the path to your CSS file or directory.
emify [baseSize] [path]
baseSize
: The base font size in pixels (default: 16px).path
: The path to the CSS file or directory. Defaults to the current working directory.
Convert all .css
files in the current directory:
emify
Convert a specific CSS file with a custom base size:
emify 18 path/to/your/file.css
Convert all .css
files in a specific directory:
emify 16 path/to/your/directory
Emifier should be automatically added to your system's PATH when installed globally via npm. If you encounter an issue where emifier
is not recognized as a command, you may need to manually add npm's global installation directory to your PATH.
First, find out where npm installs global packages on your system:
npm prefix -g
This command will return the path to npm's global installation directory.
- Search for "Environment Variables" in your Windows search and select "Edit the system environment variables."
- In the System Properties window, click on "Environment Variables."
- Under "System variables," find and select the
Path
variable, then click "Edit." - Click "New" and add the path you obtained from
npm prefix -g
. - Click "OK" to close all dialogs and apply the changes.
Add the following line to your .bashrc
, .zshrc
, or equivalent shell configuration file:
export PATH="$(npm prefix -g)/bin:$PATH"
Then, refresh your terminal or source the configuration file:
source ~/.bashrc
# or
source ~/.zshrc
After these steps, you should be able to run emifier
from your terminal.
- yargs: ^17.7.2
Farouk Charkas [email protected]
MIT License