Repository
Current version released
a year ago
Versions
- v2.10.3Latest
- v2.10.2
- v2.10.1
- v2.10.0
- v2.9.1
- v2.8.1
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.1
- v2.5.0
- v2.4.0
- v2.3.1
- v2.3.0e
- v2.3.0d
- v2.3.0c
- v2.3.0b
- v2.3.0
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.7
- v2.0.7rc2
- v2.0.7rc1
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.1
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3e
- v1.0.3d
- v1.0.3c
- v1.0.3b
- v1.0.3
- v1.0.2c
- v1.0.2b
- v1.0.2
- v1.0.1b
- v1.0.1a
- v1.0.1
- v1.0.0
Deno Web Serve
Template repo with this structure: https://github.com/pagoru/deno-web-serve-template
File structure
- /.env
- /dev.ts
- /main.ts
- /public/index.html
- /public/assets/…
- /src/main.tsx
.env
ENVIRONMENT=DEVELOPMENT
dev.ts
import { load } from "deno/dotenv/mod.ts";
const env = await load();
Object.keys(env).forEach((key) => Deno.env.set(key, env[key]));
await import("./main.ts");
main.ts
import { webServe } from "deno_web_serve/mod.ts";
await webServe({
port: 8080,
indexFileName: "main.tsx",
minify: false,
externals: [],
envs: ["ENVIRONMENT"],
mixAllInsideIndex: false,
});
build.ts
import { build } from "deno_web_serve";
import { load } from "deno/dotenv/mod.ts";
const env = await load();
Object.keys(env).forEach((key) => Deno.env.set(key, env[key]));
await build({
indexFileName: "main.ts",
minify: true,
mixAllInsideIndex: true,
envs: ["ENVIRONMENT"],
});
deno.json
{
"tasks": {
"start": "deno run -A ./dev.ts",
"build": "deno run -A ./build.ts"
},
"imports": {
"deno/": "https://deno.land/std@0.194.0/",
"deno_web_serve": "https://deno.land/x/deno_web_serve@v2.0.0/mod.ts"
}
}
/public/index.html
<html>
<head>
...
<!-- STYLES_FILE -->
</head>
...
<!-- SCRIPT_ENVS -->
<!-- SCRIPT_BUNDLE -->
<!-- SCRIPT_FOOTER -->
</html>