Files
linguist/vendor/grammars/less.tmbundle/DragCommands/Insert inline Image.tmDragCommand
2016-02-29 07:54:29 -07:00

39 lines
1.1 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env php
&lt;?php
$path = getenv('TM_DROPPED_FILE');
$path_parts = pathinfo($path);
$info = getimagesize($path);
list($width, $height) = $info;
$mime = $info['mime'];
$contents = base64_encode(file_get_contents($path));
echo "@gfx-{$path_parts['filename']}: \"data:{$mime};base64,{$contents}\";\n";
echo "@gfx-{$path_parts['filename']}-width: {$width}px;\n";
echo "@gfx-{$path_parts['filename']}-height: {$height}px;";</string>
<key>draggedFileExtensions</key>
<array>
<string>png</string>
<string>jpeg</string>
<string>jpg</string>
<string>gif</string>
</array>
<key>input</key>
<string>selection</string>
<key>name</key>
<string>Insert inline Image</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.css.less</string>
<key>uuid</key>
<string>7B0CA307-CC1C-4EE2-9F63-4825800ACDA7</string>
</dict>
</plist>