mirror of
https://github.com/BradNut/skeleton
synced 2025-09-08 17:40:25 +00:00
Svelete Kit Skeleton up to number 16.
This commit is contained in:
commit
8a1d523d10
30 changed files with 8308 additions and 0 deletions
15
.eslintrc.cjs
Normal file
15
.eslintrc.cjs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: ['eslint:recommended', 'prettier'],
|
||||||
|
plugins: ['svelte3'],
|
||||||
|
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaVersion: 2019
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2017: true,
|
||||||
|
node: true
|
||||||
|
}
|
||||||
|
};
|
||||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
1
.npmrc
Normal file
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
engine-strict=true
|
||||||
4
.prettierignore
Normal file
4
.prettierignore
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.svelte-kit/**
|
||||||
|
static/**
|
||||||
|
build/**
|
||||||
|
node_modules/**
|
||||||
6
.prettierrc
Normal file
6
.prettierrc
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
||||||
38
README.md
Normal file
38
README.md
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
# create-svelte
|
||||||
|
|
||||||
|
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
||||||
|
|
||||||
|
## Creating a project
|
||||||
|
|
||||||
|
If you're seeing this, you've probably already done this step. Congrats!
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# create a new project in the current directory
|
||||||
|
npm init svelte@next
|
||||||
|
|
||||||
|
# create a new project in my-app
|
||||||
|
npm init svelte@next my-app
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: the `@next` is temporary
|
||||||
|
|
||||||
|
## Developing
|
||||||
|
|
||||||
|
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
|
||||||
|
# or start the server and open the app in a new browser tab
|
||||||
|
npm run dev -- --open
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
||||||
9
jsconfig.json
Normal file
9
jsconfig.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"$lib/*": ["src/lib/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||||
|
}
|
||||||
19
mdsvex.config.cjs
Normal file
19
mdsvex.config.cjs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
module.exports = {
|
||||||
|
extensions: [".svelte.md", ".md", ".svx"],
|
||||||
|
smartypants: {
|
||||||
|
dashes: "oldschool",
|
||||||
|
},
|
||||||
|
remarkPlugins: [
|
||||||
|
[require("remark-github"), {
|
||||||
|
// Use your own repository
|
||||||
|
repository: "https://github.com/svelte-add/mdsvex.git",
|
||||||
|
}],
|
||||||
|
require("remark-abbr"),
|
||||||
|
],
|
||||||
|
rehypePlugins: [
|
||||||
|
require("rehype-slug"),
|
||||||
|
[require("rehype-autolink-headings"), {
|
||||||
|
behavior: "wrap",
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
};
|
||||||
4
mdsvex.config.js
Normal file
4
mdsvex.config.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { createRequire } from "module";
|
||||||
|
const require = createRequire(import.meta.url)
|
||||||
|
|
||||||
|
export const mdsvexConfig = require("./mdsvex.config.cjs");
|
||||||
7991
package-lock.json
generated
Normal file
7991
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
32
package.json
Normal file
32
package.json
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"name": "~TODO~",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "svelte-kit dev",
|
||||||
|
"build": "svelte-kit build",
|
||||||
|
"preview": "svelte-kit preview",
|
||||||
|
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||||
|
"format": "prettier --write --plugin-search-dir=. ."
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sveltejs/kit": "next",
|
||||||
|
"autoprefixer": "^10.2.6",
|
||||||
|
"eslint": "^7.22.0",
|
||||||
|
"eslint-config-prettier": "^8.1.0",
|
||||||
|
"eslint-plugin-svelte3": "^3.2.0",
|
||||||
|
"mdsvex": "^0.9.0",
|
||||||
|
"prettier": "~2.2.1",
|
||||||
|
"prettier-plugin-svelte": "^2.2.0",
|
||||||
|
"rehype-autolink-headings": "^5.0.1",
|
||||||
|
"rehype-slug": "^4.0.1",
|
||||||
|
"remark-abbr": "^1.4.1",
|
||||||
|
"remark-github": "^10.0.1",
|
||||||
|
"svelte": "^3.34.0",
|
||||||
|
"tailwindcss": "^2.1.3"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"node-sass": "^6.0.0",
|
||||||
|
"svelte-preprocess": "^4.7.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
postcss.config.cjs
Normal file
6
postcss.config.cjs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports = {
|
||||||
|
plugins: {
|
||||||
|
autoprefixer: {},
|
||||||
|
tailwindcss: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/app.html
Normal file
12
src/app.html
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="/favicon.png" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
%svelte.head%
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="svelte">%svelte.body%</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
src/global.d.ts
vendored
Normal file
1
src/global.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/// <reference types="@sveltejs/kit" />
|
||||||
10
src/lib/Example.svelte.md
Normal file
10
src/lib/Example.svelte.md
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<script>
|
||||||
|
export let count = 21;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
# This is an example of an mdsvex component.
|
||||||
|
|
||||||
|
You can `import` it as `$lib/Example.svelte.md`.
|
||||||
|
Just **delete** this file if you don't care.
|
||||||
|
|
||||||
|
*By the way, the count is {count}.*
|
||||||
17
src/lib/header.svelte
Normal file
17
src/lib/header.svelte
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<header>
|
||||||
|
<h1>Welcome</h1>
|
||||||
|
<nav>
|
||||||
|
<a href="/">Home</a>
|
||||||
|
<a href="/about">About Us</a>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Svelte CSS is Scoped by default -->
|
||||||
|
<!-- <style lang="scss">
|
||||||
|
header {
|
||||||
|
background: red;
|
||||||
|
nav {
|
||||||
|
background: blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style> -->
|
||||||
6
src/posts/goodbye.md
Normal file
6
src/posts/goodbye.md
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
title: Goodbye
|
||||||
|
slug: goodbye
|
||||||
|
---
|
||||||
|
|
||||||
|
# {title}
|
||||||
11
src/posts/hello.md
Normal file
11
src/posts/hello.md
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
title: Hello World
|
||||||
|
slug: hello
|
||||||
|
---
|
||||||
|
|
||||||
|
# {title}
|
||||||
|
|
||||||
|
lorem ipsum
|
||||||
|
|
||||||
|
- Hello
|
||||||
|
- World
|
||||||
19
src/routes/__layout.svelte
Normal file
19
src/routes/__layout.svelte
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script>
|
||||||
|
import Header from '$lib/header.svelte';
|
||||||
|
import '../tailwind.css';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<main class="bg-blue-400">
|
||||||
|
<slot />
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer>Copyright 2021</footer>
|
||||||
|
|
||||||
|
<!-- Svelte CSS is Scoped by default -->
|
||||||
|
<!-- <style>
|
||||||
|
:global(header) {
|
||||||
|
background: red;
|
||||||
|
}
|
||||||
|
</style> -->
|
||||||
6
src/routes/about.svelte
Normal file
6
src/routes/about.svelte
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<h1>About Us</h1>
|
||||||
|
<p>
|
||||||
|
Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti in natus, at laboriosam
|
||||||
|
laudantium amet eum aliquid repellat minima exercitationem officiis quibusdam voluptates eaque
|
||||||
|
assumenda vero consectetur repellendus, illum cum.
|
||||||
|
</p>
|
||||||
3
src/routes/index.svelte
Normal file
3
src/routes/index.svelte
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<h1>Welcome to Level Up</h1>
|
||||||
|
<h2>Hi y'all</h2>
|
||||||
|
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
||||||
20
src/routes/posts/[slug].svelte
Normal file
20
src/routes/posts/[slug].svelte
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<script context="module">
|
||||||
|
export async function load({ page }) {
|
||||||
|
const Hello = await import(`../../posts/${page.params.slug}.md`);
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
Hello: Hello.default,
|
||||||
|
title: Hello.metadata.title
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export let Hello;
|
||||||
|
export let title;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h2>{title}</h2>
|
||||||
|
|
||||||
|
<Hello />
|
||||||
31
src/routes/posts/__layout.svelte
Normal file
31
src/routes/posts/__layout.svelte
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<script context="module">
|
||||||
|
export async function load() {
|
||||||
|
const posts = import.meta.globEager('../../posts/*.md');
|
||||||
|
const postsList = Object.values(posts);
|
||||||
|
const postsMeta = postsList.map((post) => {
|
||||||
|
return post.metadata;
|
||||||
|
});
|
||||||
|
console.log('postsMeta', postsMeta);
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
posts: postsMeta
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export let posts;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<slot />
|
||||||
|
<aside>
|
||||||
|
<h5>Archive</h5>
|
||||||
|
<ui>
|
||||||
|
{#each posts as post}
|
||||||
|
<li><a href={post.slug}>{post.title}</a></li>
|
||||||
|
{/each}
|
||||||
|
</ui>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
1
src/routes/posts/about.svelte
Normal file
1
src/routes/posts/about.svelte
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<h3>About this blog</h3>
|
||||||
4
src/routes/posts/index.svelte
Normal file
4
src/routes/posts/index.svelte
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<h1>Posts</h1>
|
||||||
|
<article>
|
||||||
|
<h3>New Post</h3>
|
||||||
|
</article>
|
||||||
13
src/routes/posts/post.json.js
Normal file
13
src/routes/posts/post.json.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Import db from db
|
||||||
|
|
||||||
|
export async function get({ params }) {
|
||||||
|
// db.collection.find()
|
||||||
|
// data
|
||||||
|
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
body: {
|
||||||
|
data: "test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
src/tailwind.css
Normal file
3
src/tailwind.css
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
/* @tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities; */
|
||||||
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
18
svelte.config.js
Normal file
18
svelte.config.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { mdsvex } from "mdsvex";
|
||||||
|
import { mdsvexConfig } from "./mdsvex.config.js";
|
||||||
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
import sveltePreprocess from 'svelte-preprocess';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
extensions: [".svelte", ...mdsvexConfig.extensions],
|
||||||
|
preprocess: [
|
||||||
|
mdsvex(mdsvexConfig),
|
||||||
|
sveltePreprocess(),
|
||||||
|
],
|
||||||
|
kit: {
|
||||||
|
// hydrate the <div id="svelte"> element in src/app.html
|
||||||
|
target: '#svelte'
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
4
tailwind.config.cjs
Normal file
4
tailwind.config.cjs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
mode: "jit",
|
||||||
|
purge: [ './src/**/*.svelte' ],
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue