0

For the purpose of rapid development I would like to REST POST (or websocket) changes to my server every time I save a css file. Is there an existing extension that can help me?

Harry
  • 52,711
  • 71
  • 177
  • 261

2 Answers2

0

You could use RunOnSave and call curl to make the HTTP POST request.

"emeraldwalk.runonsave": {
"commands": [
    {
        "match": "\\.css$",
        "cmd": "curl -XPOST localhost:8080/hello"
    }
]

}

jschnasse
  • 8,526
  • 6
  • 32
  • 72
  • Thanks, do you know if it's possible to read the contents of all css files with that extension? – Harry Mar 02 '20 at 17:01
  • You want to post the changed files to the server? Ok that is something different. I thought more of triggering a reload of a local running service. – jschnasse Mar 03 '20 at 09:53
  • Yep, I figured out how to read file contents and so on by reading the docs. Ended up using node http.post instead of curl. Curl is pretty unreliable as many people don't have it on their computers. – Harry Mar 03 '20 at 14:32
0

There really is none. I used RunOnSave as mentioned previously and Gist as inspiration to make my own extension.

Harry
  • 52,711
  • 71
  • 177
  • 261