New Bootstrap trick !!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

New Bootstrap trick !!!

if you wanna know all bootstrap classes go to bootstrap.css file give it .html extension and place this code in the very bottom of the file it works on Mozilla <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script> <script> $("script").empty(); //use jQuery remove script element text before analysis var bootstrapCSS = $("body").text(); //grab all text on the page (all bootstrap css) bootstrapCSS = bootstrapCSS.replace( /(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(\/\/.*)/g, "" ); // remove comments from the css bootstrapCSS = bootstrapCSS.replace( /(@media.*\{)/g, "" ); // remove media query lines up to and including first open brace bootstrapCSS = bootstrapCSS.replace( /(\{[^}]+\})/g, "" ); // remove all css in between braces var res = bootstrapCSS.match( /([\.][\w]+([-][\w]*)*)/g ); // match .classnames with any number of dashes res = _.uniq(res); //use lo-dash uniq() method to pull out duplicates res = res.sort(); //sort alphabetically (not case sensitive, but no real need) $("body").empty(); //empty the page before redisplay for (var i = 0; i < res.length; i++) { $("body").append(res[i]+"<br>"); //append each unique class name back to DOM } </script>

15th May 2017, 8:41 AM
Abdel
Abdel - avatar
1 Answer
+ 1
It seems that the code doesn't work for you guys or what ?
15th May 2017, 10:48 PM
Abdel
Abdel - avatar