There is way to create masonry without specifying x,y position of every element though. https://codepen.io/mmis1000/pen/gOyZJqE
Adding a new element still need dimension of the element and a bit JavaScript.(The whole page use < 100loc unobfuscated JavaScript) But resizing can be handled by css naturally.
I think the issue here is most people don't really have a good way to specify how masonry should work. And thus don't have a good implementation either.