Created
February 6, 2015 21:31
-
-
Save og-shawn-crigger/faac8b97c7a1cd57c60d to your computer and use it in GitHub Desktop.
Creates a array of all the scripts and styles and outputs them in json format in the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DOM ELEMENTS | |
clear(); | |
var scripts = []; | |
var styles = []; | |
console.groupCollapsed('CSS Links'); | |
console.log("Loop start."); | |
jQuery("link").each(function(index, value) { | |
var link = jQuery(this).attr('href'); | |
console.log( typeof link ); | |
if ( typeof link !== 'undefined' || '' != link || 'undefined' !== link ) { | |
console.log('link' + index + ':' + link ); | |
styles.push( link ); | |
} | |
}); | |
console.log("Loop end."); | |
console.groupEnd(); | |
console.groupCollapsed('JS Links'); | |
console.log("Loop start."); | |
jQuery("script").each(function(index, value) { | |
var link = jQuery(this).attr('src'); | |
console.log( typeof link ); | |
if ( typeof link !== 'undefined' || '' != link || 'undefined' !== link ) { | |
console.log('script' + index + ':' + link ); | |
scripts.push( link ); | |
} | |
}); | |
console.log("Loop end."); | |
console.groupEnd(); | |
//scripts = jQuery(scripts).serializeArray(); | |
//styles = jQuery(styles).serializeArray(); | |
console.log( scripts ); | |
console.log( styles ); | |
console.save( scripts, 'kk-scripts.json' ); | |
console.save( styles, 'kk-styles.json' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment