Search code examples
pug

How do you quickly convert all Jade files into Pug files?


Jade isn't called "Jade" any more. It is now known as "Pug". In order to convert an old jade project into the new pug format, you need to rename all the old .jade files to .pug files.

Doing it by hand is painful and tedious, surely there is a faster way to do it?


Solution

  • On Windows, you can rename extension recursively by this command:

    for /R %x in (*.jade) do ren "%x" *.pug
    

    Taken from this answer.

    Note that this only works in Windows Command Prompt. You will receive errors if you try to run this command in programs like Git Bash or Windows PowerShell.

    If you are a Mac user, use this command in Mac Terminal:

    find . -name '*.jade' | xargs rename 's/\.jade$/.pug/'