Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(create-vite): add Marko #19257

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/create-vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,29 @@ const FRAMEWORKS: Framework[] = [
},
],
},
{
name: 'marko',
display: 'Marko',
color: magenta,
variants: [
{
name: 'marko-ts',
display: 'TypeScript',
color: blue,
},
{
name: 'marko',
display: 'JavaScript',
color: yellow,
},
{
name: 'custom-marko-run',
display: 'Marko Run ↗',
color: red,
customCommand: 'npm create marko',
},
],
},
{
name: 'others',
display: 'Others',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Marko-JS.marko-vscode"]
}
15 changes: 15 additions & 0 deletions packages/create-vite/template-marko-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Marko + TS + Vite

This template should help get you started developing with Marko and TypeScript in Vite.

## Client-side Rendering

This starter is for a client-only application. Since Marko is at its core a server-first framework, it is recommended to use a server-side rendering setup for production applications. For a full production-ready Marko application, consider using [Marko Run](https://marko.run/).

## Recommended IDE Setup

[VS Code](https://code.visualstudio.com/) + [Marko Extension](https://marketplace.visualstudio.com/items?itemName=Marko-JS.marko-vscode).

## Need an official Marko framework?

Check out [Marko Run](https://marko.run/), which is also powered by Vite.
24 changes: 24 additions & 0 deletions packages/create-vite/template-marko-ts/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
14 changes: 14 additions & 0 deletions packages/create-vite/template-marko-ts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Marko + TS</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions packages/create-vite/template-marko-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "vite-marko-ts-starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"check": "mtc"
},
"devDependencies": {
"@marko/type-check": "^1.3.13",
"@marko/vite": "^5.0.13",
"marko": "^6.0.0-next.3.22",
"typescript": "~5.7.2",
"vite": "^6.0.5"
}
}
1 change: 1 addition & 0 deletions packages/create-vite/template-marko-ts/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions packages/create-vite/template-marko-ts/src/app.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<main>
<div>
<a href="https://vite.dev" target="_blank" rel="noreferrer">
<img src="/vite.svg" class="logo" alt="Vite Logo">
</a>
<a href="https://markojs.com" target="_blank" rel="noreferrer">
<img src="./assets/marko.svg" class="logo marko" alt="Marko Logo">
</a>
</div>
<h1>Vite + Marko</h1>

<div class="card">
<counter/>
</div>

<p>
Check out
<a href="https://marko.run/" target="_blank" rel="noreferrer">
Marko Run
</a>
, the official Marko app framework powered by Vite!
</p>

<p class="read-the-docs">
Click on the Vite and Marko logos to learn more
</p>
</main>

<style>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.marko:hover {
filter: drop-shadow(0 0 2em #ff0088aa);
}
.read-the-docs {
color: #888;
}
</style>
79 changes: 79 additions & 0 deletions packages/create-vite/template-marko-ts/src/app.style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}

body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}

h1 {
font-size: 3.2em;
line-height: 1.1;
}

.card {
padding: 2em;
}

#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
109 changes: 109 additions & 0 deletions packages/create-vite/template-marko-ts/src/assets/marko.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/create-vite/template-marko-ts/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import app from './app.marko'

app.mount({}, document.getElementById('app')!)
5 changes: 5 additions & 0 deletions packages/create-vite/template-marko-ts/src/tags/counter.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<let/count=0>

<button onClick() { count++ }>
The count is ${count}
</button>
20 changes: 20 additions & 0 deletions packages/create-vite/template-marko-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"lib": ["dom", "ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"outDir": "dist",
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ESNext",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
"types": ["vite/client"],
"verbatimModuleSyntax": true
}
}
11 changes: 11 additions & 0 deletions packages/create-vite/template-marko-ts/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'vite'
import marko from '@marko/vite'

// https://vite.dev/config/
export default defineConfig({
plugins: [
marko({
linked: false,
}),
],
})
3 changes: 3 additions & 0 deletions packages/create-vite/template-marko/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Marko-JS.marko-vscode"]
}
Loading
Loading