Search code examples
visual-studio-codeprettier

How to tranform css hex to uppercase in vscode?


I'm just using vscode prettier, and I was told that hex value should be uppercase as company's standard. I've been through a search and I found their github-issue that states,

" Personally I prefer uppercase too, but I was asked to do lowercase... But changing this would cause a lot of unnecessary churn for all Prettier users... this decision has been made and is not going to change. An option won't be added." - Sep. 29,2018

So basically, prettier transformed hex value to lowercase, and does not provide an option to change it to uppercase.

I want to ask, have they change their decision now and made an option to transform css hex value to uppercase? And if theres no really option for this in prettier, is there any alternatives to achieve this?


Solution

  • My basic alternative that I used is the idea of @rioV8, however I would prefer to use replace field instead of Transform to UpperCase, I think that would be more quick.


    I would like to provide this as answer because it's at least working.

    In vscode find #(?:[0-9a-fA-F]{3}){1,2} using regular expression, and replace it with \U$0. enter image description here


    Updated: how to auto transform after save

    Follow this link: How to automatically run a "find and replace" after save?