Skip to content

Instantly share code, notes, and snippets.

@Hsx
Created August 20, 2014 09:21
Show Gist options
  • Select an option

  • Save Hsx/d8e3aa70b8bdf26d1d82 to your computer and use it in GitHub Desktop.

Select an option

Save Hsx/d8e3aa70b8bdf26d1d82 to your computer and use it in GitHub Desktop.
<?php
$css=file('assets/bootstrap/3.2.0/dist/css/bootstrap.css');
$css=implode('',$css);
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="HSX">
<meta name="Keywords" content="">
<meta name="Description" content="bootstrap class listen">
<title>Document</title>
</head>
<body>
<PRE><?php
echo $css;
?></PRE>
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://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
$("body").append("BOOTSTRAP CLASS LİST<br>");
$("body").append("class sayisi :"+res.length+"<br>");
for (var i = 0; i < res.length; i++) {
$("body").append("<a href=\"https://www.google.com.tr/?gws_rd=ssl#q="+res[i]+"\+bootstrap%20class%20tutorial\" target=\"_blank\">"+res[i]+"<br>"); //append each unique class name back to DOM
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment