Skip to content

Instantly share code, notes, and snippets.

@slywalker
Created April 10, 2012 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slywalker/2348542 to your computer and use it in GitHub Desktop.
Save slywalker/2348542 to your computer and use it in GitHub Desktop.
<?php
$css = file_get_contents('bootstrap.css');
preg_match_all('/\.(([a-z]+\-)[a-z]+)/m', $css, $matches);
foreach ($matches[1] as $key => $value) {
$snippet = <<< EOF
<snippet>
<content><![CDATA[{$value}]]></content>
<tabTrigger>{$matches[2][$key]}</tabTrigger>
<scope>text.html</scope>
<description>{$value} Bootstrap</description>
</snippet>
EOF;
file_put_contents('snippet/Bootstrap-' . $value . '.sublime-snippet', $snippet);
echo $value . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment