Skip to content

Instantly share code, notes, and snippets.

@gabrielmansour
Last active December 23, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmansour/6614798 to your computer and use it in GitHub Desktop.
Save gabrielmansour/6614798 to your computer and use it in GitHub Desktop.
Get a list of stylesheet paths for an HTML document.
$.each(document.styleSheets, function() {
this.href ? console.log(this.href) : $.map(this.cssRules, function(import){ console.log(import.href) })
})
all_css = ['...'] # array of previously-generated URLs
sizes = all_css.map{ |f| f['http:'] ? open(f).size : File.size(f) }
sizes.inject(&:+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment