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

Add Rsbuild + framework examples #26

Merged
merged 1 commit into from
Feb 20, 2024
Merged
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
13 changes: 13 additions & 0 deletions rsbuild/lit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Local
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/

# IDE
.vscode/*
!.vscode/extensions.json
.idea
29 changes: 29 additions & 0 deletions rsbuild/lit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rsbuild Project

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm dev
```

Build the app for production:

```bash
pnpm build
```

Preview the production build locally:

```bash
pnpm preview
```
15 changes: 15 additions & 0 deletions rsbuild/lit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "rsbuild-lit",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "rsbuild dev --open",
"build": "rsbuild build",
"preview": "rsbuild preview"
},
"devDependencies": {
"@rsbuild/core": "^0.4.3",
"lit": "^3.1.2",
"typescript": "^5.3.0"
}
}
7 changes: 7 additions & 0 deletions rsbuild/lit/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from '@rsbuild/core';

export default defineConfig({
html: {
template: './src/index.html',
},
});
1 change: 1 addition & 0 deletions rsbuild/lit/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@rsbuild/core/types" />
6 changes: 6 additions & 0 deletions rsbuild/lit/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body {
margin: 0;
color: #fff;
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
background-image: linear-gradient(to bottom, #020917, #101725);
}
5 changes: 5 additions & 0 deletions rsbuild/lit/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!doctype html>
<head></head>
<body>
<my-element />
</body>
4 changes: 4 additions & 0 deletions rsbuild/lit/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './index.css';
import { MyElement } from './my-element';

customElements.define('my-element', MyElement);
34 changes: 34 additions & 0 deletions rsbuild/lit/src/my-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { html, css, LitElement } from 'lit';

export class MyElement extends LitElement {
static styles = css`
.content {
display: flex;
min-height: 100vh;
line-height: 1.1;
text-align: center;
flex-direction: column;
justify-content: center;
}

.content h1 {
font-size: 3.6rem;
font-weight: 700;
}

.content p {
font-size: 1.2rem;
font-weight: 400;
opacity: 0.5;
}
`;

render() {
return html`
<div class="content">
<h1>Rsbuild with Lit</h1>
<p>Start building amazing things with Rsbuild.</p>
</div>
`;
}
}
14 changes: 14 additions & 0 deletions rsbuild/lit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["DOM", "ES2020"],
"module": "ESNext",
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true
},
"include": ["src"]
}
13 changes: 13 additions & 0 deletions rsbuild/preact/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Local
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/

# IDE
.vscode/*
!.vscode/extensions.json
.idea
29 changes: 29 additions & 0 deletions rsbuild/preact/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rsbuild Project

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm dev
```

Build the app for production:

```bash
pnpm build
```

Preview the production build locally:

```bash
pnpm preview
```
18 changes: 18 additions & 0 deletions rsbuild/preact/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "rsbuild-preact",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "rsbuild dev --open",
"build": "rsbuild build",
"preview": "rsbuild preview"
},
"dependencies": {
"preact": "^10.19.4"
},
"devDependencies": {
"@rsbuild/core": "^0.4.3",
"@rsbuild/plugin-preact": "^0.4.3",
"typescript": "^5.3.0"
}
}
6 changes: 6 additions & 0 deletions rsbuild/preact/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from '@rsbuild/core';
import { pluginPreact } from '@rsbuild/plugin-preact';

export default defineConfig({
plugins: [pluginPreact()],
});
26 changes: 26 additions & 0 deletions rsbuild/preact/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
body {
margin: 0;
color: #fff;
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
background-image: linear-gradient(to bottom, #020917, #101725);
}

.content {
display: flex;
min-height: 100vh;
line-height: 1.1;
text-align: center;
flex-direction: column;
justify-content: center;
}

.content h1 {
font-size: 3.6rem;
font-weight: 700;
}

.content p {
font-size: 1.2rem;
font-weight: 400;
opacity: 0.5;
}
12 changes: 12 additions & 0 deletions rsbuild/preact/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import './App.css';

const App = () => {
return (
<div className="content">
<h1>Rsbuild with Preact</h1>
<p>Start building amazing things with Rsbuild.</p>
</div>
);
};

export default App;
4 changes: 4 additions & 0 deletions rsbuild/preact/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { render } from 'preact';
import App from './App';

render(<App />, document.getElementById('root')!);
20 changes: 20 additions & 0 deletions rsbuild/preact/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["DOM", "ES2020"],
"module": "ESNext",
"jsx": "react-jsx",
"jsxImportSource": "preact",
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true,
"paths": {
"react": ["./node_modules/preact/compat/"],
"react-dom": ["./node_modules/preact/compat/"]
}
},
"include": ["src"]
}
13 changes: 13 additions & 0 deletions rsbuild/solid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Local
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/

# IDE
.vscode/*
!.vscode/extensions.json
.idea
29 changes: 29 additions & 0 deletions rsbuild/solid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rsbuild Project

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm dev
```

Build the app for production:

```bash
pnpm build
```

Preview the production build locally:

```bash
pnpm preview
```
19 changes: 19 additions & 0 deletions rsbuild/solid/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "rsbuild-solid",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "rsbuild dev --open",
"build": "rsbuild build",
"preview": "rsbuild preview"
},
"dependencies": {
"solid-js": "^1.8.5"
},
"devDependencies": {
"@rsbuild/core": "^0.4.3",
"@rsbuild/plugin-babel": "^0.4.3",
"@rsbuild/plugin-solid": "^0.4.3",
"typescript": "^5.3.0"
}
}
13 changes: 13 additions & 0 deletions rsbuild/solid/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from '@rsbuild/core';
import { pluginBabel } from '@rsbuild/plugin-babel';
import { pluginSolid } from '@rsbuild/plugin-solid';

export default defineConfig({
plugins: [
pluginBabel({
include: /\.(?:jsx|tsx)$/,
exclude: /[\\/]node_modules[\\/]/,
}),
pluginSolid(),
],
});
26 changes: 26 additions & 0 deletions rsbuild/solid/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
body {
margin: 0;
color: #fff;
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
background-image: linear-gradient(to bottom, #020917, #101725);
}

.content {
display: flex;
min-height: 100vh;
line-height: 1.1;
text-align: center;
flex-direction: column;
justify-content: center;
}

.content h1 {
font-size: 3.6rem;
font-weight: 700;
}

.content p {
font-size: 1.2rem;
font-weight: 400;
opacity: 0.5;
}
12 changes: 12 additions & 0 deletions rsbuild/solid/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import './App.css';

const App = () => {
return (
<div class="content">
<h1>Rsbuild with Solid</h1>
<p>Start building amazing things with Rsbuild.</p>
</div>
);
};

export default App;
1 change: 1 addition & 0 deletions rsbuild/solid/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@rsbuild/core/types" />
Loading
Loading