5 ms·
Visualize How CSS Rules Interact with a Page
- leeoniya 13y agoi'm not sure how useful this is compared to something like a css profiler, but it's definitely cool
- benjaminbenben 13y agothanks. Yeah - it's not as useful as something like css profiler, I built it to work out if there were ways that I could architect my css in a more efficient way.. Though it looked cool, so I threw it online!
- cheshire137 13y agoI think I'm making it angry. I tried 3till7.net and then civchoice.com, both of which 'failed to load'.
- Groxx 13y agoNeat, though I haven't been able to get it to load anything but the examples. Is this done server-side, and it's just overloaded? Or is there something odd about e.g. yahoo.com ?
- benjaminbenben 13y agoyup, it's just overloaded at the moment. It's serverside using phantomjs - I'm running it through cloudfront so the common urls are cached there.
- dm8 13y agoCool. I'm curious - how'd you do it? Is there any open source library to find out CSS rules?
- yuchi 13y agoYou can use cssom (by visionmedia) and document.querySelectorAll/sizzle.
- hacker789 13y agoPresumably, you could take the selectors in the CSS and pass them to a JavaScript selector engine. That way, you'd automatically have a list of elements affected by each rule.
- benjaminbenben 13y agodocument.stylesheets - https://developer.mozilla.org/en-US/docs/Web/API/document.styleSheets https://developer.mozilla.org/en-US/docs/Web/API/document.st... The main part of the injected code is https://gist.github.com/benfoxall/5647039 https://gist.github.com/benfoxall/5647039 - there's a bit of hacking round cors issues there too.
- kirbysayshi 13y agoSeems to be broken in FF 23
- benjaminbenben 13y agoyeah - there were issues in FF dealing with large data-url embedded images in a json file. I'm looking into it though.
- bzbarsky 13y agoPlease do file a bug with a testcase if you have a testcase. That should make it pretty simple to determine where the problem is.
- benjaminbenben 13y agoYup - It's been falling over quite a lot in the last couple of hours! It is all served through cloudfront so that the popular urls get cached (which is why I added the example links - so they would hit the cache). I've just thrown a whole load more heroku dynos at it, so it seems to be working okay again now! (I built this!)
- sergiotapia 13y agoOut of curiousity how many dynos did you add during this peak time?
- benjaminbenben 13y agoI went to 5 and was still seeing a lot of errors, so upped it to 10.
- psychometry 13y agoDo you know about Adept Scale? https://www.adeptscale.com https://www.adeptscale.com
- benjaminbenben 13y agoI didn't. That's fantastic - exactly what I needed; added it and gone back down to 2 dynos.
- meerita 13y agoFor some reason my website isn't loaded on the left side. I see my rules, but not the screen. My website loads in 300ms or a bit more and it's way optimized. http://minid.net http://minid.net
- nuclear_eclipse 13y agoIs there not a way to scroll down the target page, or am I missing something? I would love to be able to see this for the lower portions of my site, but it seems that I only can only scroll through the CSS styles themselves...
- arb99 13y agoZooming out (using the browsers page zoom i.e. cmd/ctrl -) kind of works. There is a html element <div id="zoom">-</div> on the page though but can't actually see it. I'm guessing that will zoom the page out.
- benjaminbenben 13y agoThat's the minus sign on the bottom right - it's for zooming the css list so that it's all in view (it was originally built to see if appended styles were more specific on a page).
- Raphael 13y agoI don't understand. Are the blue lines supposed to represent something?
- dubcanada 13y agoLittle confused... Why do like 90% of the css tags either go to the very top left or to the bottom left? Shouldn't every tag have a specific area?