You can do this one of two ways:
* either use media queries with the same or similar breakpoints
* or use window matchmedia (https://developer.mozilla.org/en-US/docs/Web/API/Window.matchMedia
But here is the thing -- match media does not work in IE9, where as the mediaqueries will.
That said, there is no way you can do this on the server or atleast not in a way that will otherwise involve some client side snooping.
Do you need things just for SpanXS or you would like a more broad generic example covering all breakpoints?
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.