JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
function dirify (s,d) {
if (!d)
d = "_";
s = s.replace(/<[^>]+>/g, '');
for (var p in dirify_table)
if (s.indexOf(p) != -1)
s = s.replace(new RegExp(p, "g"), dirify_table[p]);
s = s.toLowerCase();
s = s.replace(/&[^;\s]+;/g, '');
s = s.replace(/[^-a-z0-9_ ]/g, '');
s = s.replace(/\s+/g, '_');
s = s.replace(/_+$/, '');
s = s.replace(/_+/g, d);
return s;
}
var dirify_table = {
"\u0026": 'and', // ampersand
"\u00C0": 'A', // A`
"\u00E0": 'a', // a`
"\u00C1": 'A', // A'
"\u00E1": 'a', // a'
"\u00C2": 'A', // A^
"\u00E2": 'a', // a^
"\u0102": 'A', // latin capital letter a with breve
"\u0103": 'a', // latin small letter a with breve
"\u00C6": 'AE', // latin capital letter AE
"\u00E6": 'ae', // latin small letter ae
"\u00C5": 'A', // latin capital letter a with ring above
"\u00E5": 'a', // latin small letter a with ring above
"\u0100": 'A', // latin capital letter a with macron
"\u0101": 'a', // latin small letter a with macron
"\u0104": 'A', // latin capital letter a with ogonek
"\u0105": 'a', // latin small letter a with ogonek
"\u00C4": 'A', // A:
"\u00E4": 'a', // a:
"\u00C3": 'A', // A~
"\u00E3": 'a', // a~
"\u00C8": 'E', // E`
"\u00E8": 'e', // e`
"\u00C9": 'E', // E'
"\u00E9": 'e', // e'
"\u00CA": 'E', // E^
"\u00EA": 'e', // e^
"\u00CB": 'E', // E:
"\u00EB": 'e', // e:
"\u0112": 'E', // latin capital letter e with macron
"\u0113": 'e', // latin small letter e with macron
"\u0118": 'E', // latin capital letter e with ogonek
"\u0119": 'e', // latin small letter e with ogonek
...