I'm trying to build a plugin for the web service Prefixr
using cURL if it's available on the system. I'm capable of getting the selections from all selection regions and concatenate them into one selection, however I'm then unable to concatenate them to a variable like:
- Code: Select all
cssComm = '"css=' + selectedCSS + "'"
I then have absolutely no idea how to take the output from cURL command and replace the selection with it
I've actually been working on a Prefixr plugin over the past couple days and I just pushed it live at http://wbond.net/sublime_packages/prefixr
. Of course, you can grab it through Package Control.
I ended up using urllib2 to do the requests so that the plugin would work on all platforms without any external dependencies. I did the requests in a thread so that if a user has a slow internet connection, the whole ST2 interface does not freeze.
The first step was to detect if the selection contained braces, and if so, I just passed the selected CSS to Prefix and used the view.replace() method
to replace the original with the prefixed CSS. For selections that didn't contain a brace I also did some whitespace gymnastics to get the Prefixr results to fit in place nicely.
You can check out the actual code at https://github.com/wbond/sublime_prefix ... Prefixr.py
. Feel free to ask any questions!