This is a tool of converting px to rem/vw/vh in a css/less file by a few settings used in intellij idea or webstorm.
This plugin has been put in the market and you can find it in file - settings - plugins - marketplace
by searching a text of px2rem
.
You can also download the plugin file which has been put in release, and install the plugin from disk.
If you have any questions or suggestions, please contact me.
QQ: 991637393
email: [email protected]
there are three ways to convert: short-cut key, code intention, code completion. you can find the settings related to these converting ways in settings page with the path 'File - Settings - Px to Rem'
- short-cut key
select a converting type from three options of rem, vw, vh in setting page and give a necessary value set below the radio group, then use the default short-cut key of Alt + d to convert a line or a selected text. you can also use the short-cut key of Ctrl + Alt + d to convert in a whole file. you can only choose one converting type of short-cut key from rem,vw,vg to convert. btw, you can change the short-cut key in your ide by setting the keymap option.
- code intention
you can find three code intention types in settings page and you can select if a code intention type works by check the checkbox. by check a code intention in a line of a css file, which will display by typing Alt + Shift, you can convert the line where the caret displays. the unselected code intention types in settings page will not show in the list of code intention in a css file
- code completion
you can also find three code completion types in the settings page and you can select if a code completion type works by check the checkbox. by typing 'px' in a css file, you can find some code completion types you set in settings page. choose a type then it will give a result of converting. the unselected code completion types in settings page will not show in the list of code completion in a css file
Instructions:
- find menu at 'File - Settings - Px to Rem', and give some settings.
- select a text or move cursor at a line which contains a 'px' value.
- use default shortcut key Alt + d to convert px to rem/vw/vh with a line; btw, you can change the shortcut at 'File - Settings - keymap - Plug-ins - px2rem'.
- use default shortcut key Ctrl + Alt + d to convert px to rem/vw/vh in a whole file.
- use a code intention to convert px to rem/vw/vh in a css file
- use a code completion to convert px to rem/vw/vh in a css file
- use the short-cut key Ctrl + Shift + Alt + d to rollback the converting within one line