Luther Wen Xu 2021-05-13 16:55:19 +07:00 committed by Chan Wen Xu
commit ff655df1e2
Signed by: chanbakjsd
GPG Key ID: 7E9A74B1B07A7558
11 changed files with 6156 additions and 0 deletions

@ -0,0 +1,35 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
}

4
.gitignore vendored

@ -0,0 +1,4 @@
/node_modules/
/public/build/
.DS_Store

5965
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,31 @@
{
"name": "svelte-app",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public --no-clear"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"eslint": "^7.25.0",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",
"svelte": "^3.0.0"
},
"dependencies": {
"@rollup/plugin-image": "^2.0.6",
"@tailwindcss/jit": "^0.1.18",
"postcss": "^8.2.12",
"postcss-cli": "^8.3.1",
"sirv-cli": "^1.0.0",
"svelte-preprocess": "^4.7.2",
"svelte-simple-modal": "^0.10.1",
"tailwindcss": "^2.1.2"
}
}

@ -0,0 +1,6 @@
module.exports = () => ({
plugins: [
require("@tailwindcss/jit"),
require("autoprefixer")
],
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="stylesheet" href="build/bundle.css">
<script defer src="build/bundle.js"></script>
</head>
<body>
</body>
</html>

@ -0,0 +1,70 @@
import svelte from "rollup-plugin-svelte";
import commonjs from "@rollup/plugin-commonjs";
import image from "@rollup/plugin-image";
import resolve from "@rollup/plugin-node-resolve";
import livereload from "rollup-plugin-livereload";
import { terser } from "rollup-plugin-terser";
import css from "rollup-plugin-css-only";
import sveltePreprocess from "svelte-preprocess";
const production = !process.env.ROLLUP_WATCH;
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = require("child_process").spawn("npm", ["run", "start", "--", "--dev"], {
stdio: ["ignore", "inherit", "inherit"],
shell: true
});
process.on("SIGTERM", toExit);
process.on("exit", toExit);
}
};
}
export default {
input: "src/main.js",
output: {
sourcemap: true,
format: "iife",
name: "app",
file: "public/build/bundle.js"
},
plugins: [
svelte({
preprocess: sveltePreprocess({
defaults: {
style: "postcss"
},
postcss: {}
}),
compilerOptions: {
dev: !production
}
}),
css({ output: "bundle.css" }),
resolve({
browser: true,
dedupe: ["svelte"]
}),
commonjs(),
image(),
// Serve and Live Reload.
!production && serve(),
!production && livereload("public"),
// Minify.
production && terser()
],
watch: {
clearScreen: false
}
};

@ -0,0 +1,9 @@
<main class="bg-gray-800 text-gray-50 w-screen h-screen">
<h1 class="text-2xl">Svelte + Tailwind JIT starter</h1>
</main>
<style global lang="postcss">
@tailwind base;
@tailwind components;
@tailwind utilities;
</style>

@ -0,0 +1,7 @@
import App from "./App.svelte";
const app = new App({
target: document.body
});
export default app;

@ -0,0 +1,14 @@
module.exports = {
mode: "jit",
purge: {
enabled: process.env.NODE_ENV === "production",
safeList: [],
content: [
"./index.html",
"./src/**/*.svelte",
],
},
theme: {},
variants: {},
plugins: []
};