If you want to add filtering option to your image grid, this handy snippet using Jade and Flexbox might be just what you are looking for. Designed by Christopher Schuck.
If you are having trouble with the pen, try the archived copy on GitHub
See the Pen New sorting method with Jade & Flexbox by Christopher Schuck (@mofny) on CodePen.0