A solution for 2021...
QLColorCode is an alternative to QLStephen. I have used them both over the years but have had more success with the former. My use case is being able to read my-example.Dockerfile
but you should be able to adapt to what you need.
First, let's install QLColorCode:
>brew install qlcolorcode
Now get the metadata name that MacOS uses for your file. To do this we use the mdls
command from the Terminal and call it on the path to an example of the filetype you want to configure quicklook for.
>mdls -name kMDItemContentType ~/Documents/my-example.Dockerfile
For me this outputs:
kMDItemContentType = "dyn.ah62d4rv4ge80k55drrw1e3xmrvwu"
Copy the part in quotes as you will need this in a moment. Open the Info.plist for QLColorCode in your favourite text editor. I like vim.
>vim ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Info.plist
Navigate down to the part that looks like this:
<array>
<string>public.source-code</string>
<string>public.yaml</string>
<string>com.apple.xcode.tcsh-script</string>
[...and so on...]
</array>
Insert a new element with your copied ContentType code. It should look something like this now:
<array>
<string>public.source-code</string>
<string>public.yaml</string>
<string>com.apple.xcode.tcsh-script</string>
[...and so on...]
<string>dyn.ah62d4rv4ge80k55drrw1e3xmrvwu</string>
</array>
Save your file and relaunch Finder. To restart Finder, click on the Apple icon (top left of screen), select "Force Quit..." and then select Finder. Hit "Relaunch".
Now, when you select a *.Dockerfile
in Finder and hit spacebar, you should see the content