Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated image-matrix-replace mixin generator

  • Loading branch information...
commit 5fa247d5742824cd69f55cf6d966140a8e3fc4e8 1 parent 06d709e
@fyrebase authored
View
7 generator/image-replace-matrix/index.php
@@ -7,7 +7,8 @@ function generate() {
$source = file_get_contents('source.css');
$results = array();
- preg_match_all('/(.+?)\s?\{\s?(.+?)\s?\}/', $source, $matches);
+ //preg_match_all('/(.+?)\s?\{\s?(.+?)\s?\}/', $source, $matches);
+ preg_match_all('/(?ims)([a-z0-9\s\.\:#_\-@]+)\{([^\}]*)\}/', $source, $matches);
foreach($matches[0] AS $i => $original) {
foreach(explode(';', $matches[2][$i]) AS $attr) {
@@ -31,9 +32,9 @@ function generate() {
break;
}
- $str = str_replace('.', '=', $matches[1][$i]) . "-replaced {\n";
+ $str = str_replace('.', '=', trim($matches[1][$i])) . " {\n\t";
$str .= '+image-matrix-replace(##MATRIX_CONSTANT##, ' . $width . ', ' . $height . ', ' . $bgp . ');';
- $str .= "\n}";
+ $str .= "\n}\n";
$results[$i] = $str;
}
View
48 generator/image-replace-matrix/source.css
@@ -1,41 +1,7 @@
-.icon-bike-atv{ background-position: 0 0; width: 49px; height: 34px; }
-.icon-bike-cruiser{ background-position: 0 -84px; width: 57px; height: 32px; }
-.icon-bike-offroad{ background-position: 0 -166px; width: 55px; height: 34px; }
-.icon-bike-scooter{ background-position: 0 -250px; width: 43px; height: 33px; }
-.icon-bike-sports{ background-position: 0 -333px; width: 51px; height: 32px; }
-.icon-bike-standard{ background-position: 0 -415px; width: 56px; height: 37px; }
-.icon-bike-touring{ background-position: 0 -502px; width: 60px; height: 35px; }
-.icon-boat-cruiser{ background-position: 0 -587px; width: 63px; height: 30px; }
-.icon-boat-jetski{ background-position: 0 -667px; width: 61px; height: 28px; }
-.icon-boat-power{ background-position: 0 -745px; width: 66px; height: 34px; }
-.icon-boat-tinny{ background-position: 0 -829px; width: 68px; height: 24px; }
-.icon-boat-yacht{ background-position: 0 -903px; width: 57px; height: 62px; }
-.icon-car-4wd{ background-position: 0 -1015px; width: 63px; height: 32px; }
-.icon-car-commercial{ background-position: 0 -1097px; width: 67px; height: 30px; }
-.icon-car-convertable{ background-position: 0 -1177px; width: 69px; height: 28px; }
-.icon-car-coupe{ background-position: 0 -1255px; width: 60px; height: 28px; }
-.icon-car-hatch{ background-position: 0 -1333px; width: 71px; height: 34px; }
-.icon-car-sedan{ background-position: 0 -1417px; width: 63px; height: 30px; }
-.icon-car-truck{ background-position: 0 -1497px; width: 65px; height: 34px; }
-.icon-car-van{ background-position: 0 -1581px; width: 67px; height: 31px; }
-.icon-car-wagon{ background-position: 0 -1662px; width: 66px; height: 32px; }
-.logo-bike-harley{ background-position: 0 -1744px; width: 44px; height: 37px; }
-.logo-bike-honda{ background-position: 0 -1831px; width: 43px; height: 33px; }
-.logo-bike-kawasaki{ background-position: 0 -1914px; width: 41px; height: 26px; }
-.logo-bike-ktm{ background-position: -121px 0; width: 52px; height: 19px; }
-.logo-bike-suzuki{ background-position: -121px -69px; width: 31px; height: 28px; }
-.logo-bike-yamaha{ background-position: -121px -147px; width: 48px; height: 31px; }
-.logo-boat-haines-hunter{ background-position: -121px -228px; width: 28px; height: 28px; }
-.logo-boat-honda{ background-position: -121px -306px; width: 43px; height: 33px; }
-.logo-boat-mercury{ background-position: -121px -389px; width: 51px; height: 31px; }
-.logo-boat-quintrexx{ background-position: -121px -470px; width: 49px; height: 34px; }
-.logo-boat-sea-doo{ background-position: -121px -554px; width: 51px; height: 24px; }
-.logo-boat-stessl{ background-position: -121px -628px; width: 67px; height: 19px; }
-.logo-car-ford{ background-position: -121px -697px; width: 49px; height: 20px; }
-.logo-car-holden{ background-position: -121px -767px; width: 31px; height: 32px; }
-.logo-car-honda{ background-position: -121px -849px; width: 34px; height: 27px; }
-.logo-car-mazda{ background-position: -121px -926px; width: 31px; height: 26px; }
-.logo-car-nissan{ background-position: -121px -1002px; width: 36px; height: 31px; }
-.logo-car-subaru{ background-position: -121px -1083px; width: 43px; height: 24px; }
-.logo-car-suzuki{ background-position: -121px -1157px; width: 31px; height: 28px; }
-.logo-car-toyota{ background-position: -121px -1235px; width: 44px; height: 27px; }
+.myClass { background-position: 0 0; width: 49px; height: 34px; }
+
+.myOtherClass {
+ background-position:0 -1333px;
+ width:71px;
+ height:34px;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.