This repository has been archived by the owner on Aug 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Serve and livereload plugins * Adding examples * Fix: Changing the acorn module source, esm.sh not exporting default
- Loading branch information
1 parent
9831892
commit 7ae41d5
Showing
12 changed files
with
176 additions
and
13 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
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,49 @@ | ||
# livereload | ||
|
||
This is a basic example to show Rollup usage with the `livereload` plugin. | ||
|
||
## Usage | ||
|
||
### Bundling | ||
|
||
#### Bundle CLI | ||
|
||
You can use the Rollup CLI to bundle files. | ||
|
||
Install the CLI: | ||
|
||
```console | ||
deno install -f -q --allow-read --allow-write --allow-net --allow-env --allow-run --unstable https://deno.land/x/drollup@2.42.3+0.17.1/rollup.ts | ||
``` | ||
|
||
And follow any suggestions to update your `PATH` environment variable. | ||
|
||
You can then bundle the files using the `rollup.config.ts` with: | ||
|
||
```console | ||
rollup -c | ||
``` | ||
|
||
### Watching | ||
|
||
#### Watch CLI | ||
|
||
Alternatively you can use the Rollup CLI to watch and rebuild your bundle. | ||
|
||
Install the CLI (same as before): | ||
|
||
```console | ||
deno install -f -q --allow-read --allow-write --allow-net --allow-env --allow-run --unstable https://deno.land/x/drollup@2.42.3+0.17.1/rollup.ts | ||
``` | ||
|
||
And follow any suggestions to update your `PATH` environment variable. | ||
|
||
You can then bundle the files using the `rollup.config.ts` with: | ||
|
||
```console | ||
rollup -c --watch | ||
``` | ||
|
||
When using the `--watch` CLI, not only will your bundle be rebuilt when your | ||
source files change, but Rollup will also reload your `rollup.config.ts` file | ||
when that changes. |
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,14 @@ | ||
import serve from 'https://deno.land/x/drollup_plugin_serve@1.1.0+0.1.3/mod.ts' | ||
import live from 'https://deno.land/x/drollup_plugin_livereload@0.1.0/mod.ts' | ||
|
||
export default { | ||
input: 'src/entry.ts', | ||
output: { | ||
file: 'src/dest.js', | ||
format: 'cjs', | ||
}, | ||
plugins: [ | ||
serve({ contentBase: 'src', port: Math.round(Math.random() * 10000) + 40000 }), | ||
live(['src']), | ||
], | ||
} |
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 @@ | ||
window.onload = () => | ||
(document.body.innerHTML += | ||
'<br>Path: ' + window.location.pathname + '<br>Date: ' + Date.now()) |
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,4 @@ | ||
<head> | ||
<title>test UPDATE</title> | ||
</head> | ||
<script src="dest.js"></script> |
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,49 @@ | ||
# serve | ||
|
||
This is a basic example to show Rollup usage with the `serve` plugin. | ||
|
||
## Usage | ||
|
||
### Bundling | ||
|
||
#### Bundle CLI | ||
|
||
You can use the Rollup CLI to bundle files. | ||
|
||
Install the CLI: | ||
|
||
```console | ||
deno install -f -q --allow-read --allow-write --allow-net --allow-env --allow-run --unstable https://deno.land/x/drollup@2.42.3+0.17.1/rollup.ts | ||
``` | ||
|
||
And follow any suggestions to update your `PATH` environment variable. | ||
|
||
You can then bundle the files using the `rollup.config.ts` with: | ||
|
||
```console | ||
rollup -c | ||
``` | ||
|
||
### Watching | ||
|
||
#### Watch CLI | ||
|
||
Alternatively you can use the Rollup CLI to watch and rebuild your bundle. | ||
|
||
Install the CLI (same as before): | ||
|
||
```console | ||
deno install -f -q --allow-read --allow-write --allow-net --allow-env --allow-run --unstable https://deno.land/x/drollup@2.42.3+0.17.1/rollup.ts | ||
``` | ||
|
||
And follow any suggestions to update your `PATH` environment variable. | ||
|
||
You can then bundle the files using the `rollup.config.ts` with: | ||
|
||
```console | ||
rollup -c --watch | ||
``` | ||
|
||
When using the `--watch` CLI, not only will your bundle be rebuilt when your | ||
source files change, but Rollup will also reload your `rollup.config.ts` file | ||
when that changes. |
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,19 @@ | ||
import serve from 'https://deno.land/x/drollup_plugin_serve@1.1.0+0.1.3/mod.ts' | ||
|
||
export default { | ||
input: 'src/entry.ts', | ||
output: { | ||
file: 'src/dest.js', | ||
format: 'cjs', | ||
}, | ||
plugins: [ | ||
serve({ | ||
contentBase: 'src', | ||
port: Math.round(Math.random() * 10000) + 40000, | ||
historyApiFallback: '/index.html' | ||
}), | ||
], | ||
watch: { | ||
include: ["src/**"], | ||
} | ||
} |
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 @@ | ||
'use strict'; | ||
|
||
document.querySelector("#content").innerHTML = `<h1>This is a history fallback enabled website.</h1>\n<p><strong>Reach any endpoint and you will see me.</strong></p>`; |
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,2 @@ | ||
document.querySelector("#content").innerHTML = `<h1>This is a historyApiFallback enabled website.</h1> | ||
<p><strong>Reach any endpoint and you will see me.</strong></p>` |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Example</title> | ||
</head> | ||
<body> | ||
<div id="content"></div> | ||
</body> | ||
<script src="dest.js"></script> | ||
</html> |
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