diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..10d3c681 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "launch-browser", + "type": "shell", + "windows": { + "command": "${command:workbench.action.terminal.sendSequence}", + "args": [ + { + "text": "start http://localhost:8000\n" // For Windows + } + ], + "problemMatcher": [] + }, + "linux": { + "command": "/bin/bash", + "args": [ + "-c", + "if grep -q microsoft /proc/version; then powershell.exe Start-Process http://localhost:8000; else xdg-open http://localhost:8000; fi" + ], + "problemMatcher": [] + }, + "osx": { + "command": "open http://localhost:8000", // For macOS + "problemMatcher": [] + } + }, + { + "label": "php-server", + "type": "shell", + "command": "PHP_CLI_SERVER_WORKERS=2 php -S localhost:8000", + "group": { + "kind": "build", + "isDefault": true + }, + "dependsOn": [ + "launch-browser" + ] + } + ] +} diff --git a/README.md b/README.md index 1fe7caa4..2d0f669a 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,8 @@ Spawn at least two workers: PHP_CLI_SERVER_WORKERS=2 php -S localhost:8000 ``` +For convenience when using VSCode, a `tasks.json` has been defined so that you can simply type CTRL+SHIFT+B (CMD+SHIFT+B on MacOS) to start the PHP builtin server and open the browser. + # Translations