-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bc00e4
commit 45ed53f
Showing
5 changed files
with
53 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src | ||
*.json | ||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,39 @@ | ||
# bx | ||
Command line tool to run JavaScript, TypeScript or HTML files in the browser. | ||
# 🌐 exweb - a browser runner | ||
|
||
With Node.js, Deno or Bun there are so many JavaScript environments to choose from. However, nothing is as good as the browser environment. `exweb` gives you an execution runtime for the browser. | ||
|
||
For example, let's say you have a script like this: | ||
|
||
```js | ||
console.log(navigator.userAgent) | ||
``` | ||
|
||
With `exweb` you can easily run this script within different browser environments: | ||
|
||
```sh | ||
> npx exweb ./script.js | ||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 | ||
``` | ||
|
||
You can easily switch browser via the `--browserName` parameter: | ||
|
||
```sh | ||
> npx exweb ./script.js --browserName firefox | ||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0 | ||
``` | ||
|
||
It even allows you to run `.html` files, e.g. given this file: | ||
|
||
```html | ||
<script type="module"> | ||
console.log(document.querySelector('b').textContent); | ||
</script> | ||
<b>Hello World!</b> | ||
``` | ||
|
||
Running this with `exweb` results in: | ||
|
||
```sh | ||
> npx exweb ./html.html | ||
Hello World! | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<script type="module"> | ||
console.log(document.querySelector('b').textContent); | ||
</script> | ||
<b>!Hello World!</b> | ||
<b>Hello World!</b> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters