feat: leptonic 0.2.0 / leptos 0.4.10 setup based on leptonic docs
This commit is contained in:
commit
b1ffebb011
12 changed files with 2647 additions and 0 deletions
3
.cargo/config.toml
Normal file
3
.cargo/config.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[build]
|
||||
# `leptonic` depends on some `leptos-use` functions requiring this opt-in. This may change in the future.
|
||||
rustflags = ["--cfg=web_sys_unstable_apis"]
|
9
.envrc
Normal file
9
.envrc
Normal file
|
@ -0,0 +1,9 @@
|
|||
use flake .nix
|
||||
dotenv_if_exists
|
||||
|
||||
if on_git_branch; then
|
||||
echo
|
||||
git status --short --branch
|
||||
echo
|
||||
git fetch
|
||||
fi
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/target
|
||||
/generated
|
||||
/dist
|
61
.nix/flake.lock
Normal file
61
.nix/flake.lock
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1690441914,
|
||||
"narHash": "sha256-Ac+kJQ5z9MDAMyzSc0i0zJDx2i3qi9NjlW5Lz285G/I=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "db8672b8d0a2593c2405aed0c1dfa64b2a2f428f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
37
.nix/flake.nix
Normal file
37
.nix/flake.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
description = "A basic flake with a shell";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
RUST_VERSION = "1.70.0";
|
||||
in
|
||||
{
|
||||
devShell = pkgs.mkShell {
|
||||
nativeBuildInputs = [ pkgs.bashInteractive ];
|
||||
buildInputs = with pkgs; [
|
||||
rustup
|
||||
sccache
|
||||
trunk
|
||||
dart-sass
|
||||
nodePackages.vscode-html-languageserver-bin
|
||||
];
|
||||
|
||||
RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
|
||||
|
||||
shellHook = ''
|
||||
pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg
|
||||
|
||||
rustup default ${RUST_VERSION}
|
||||
rustup target add --toolchain ${RUST_VERSION} wasm32-unknown-unknown
|
||||
rustup component add --toolchain ${RUST_VERSION} cargo clippy rust-analyzer rust-docs rust-src rustfmt
|
||||
|
||||
cargo install leptosfmt
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
2440
Cargo.lock
generated
Normal file
2440
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
14
Cargo.toml
Normal file
14
Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "leptonic-template"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
leptonic = "0.2.0"
|
||||
leptos = { version = "0.4.10", features = ["csr"] }
|
||||
|
||||
[build-dependencies]
|
||||
leptonic-theme = "0.2.0"
|
||||
leptos-tiptap-build = "0.2.3"
|
13
Trunk.toml
Normal file
13
Trunk.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[watch]
|
||||
# Paths to watch. The `build.target`'s parent folder is watched by default.
|
||||
ignore = [
|
||||
# These files are generated from our build.rs script, not excluding them would result in an endless restart-cycle!
|
||||
# Keep this list in sync with what the build script generates.
|
||||
"./generated",
|
||||
]
|
||||
|
||||
[serve]
|
||||
address = "127.0.0.1"
|
||||
port = 4001
|
||||
open = false
|
||||
|
28
build.rs
Normal file
28
build.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
use std::io::Write;
|
||||
|
||||
pub fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=Cargo.lock");
|
||||
|
||||
let root_dir: std::path::PathBuf = std::env::var("CARGO_MANIFEST_DIR").unwrap().into();
|
||||
let generated_dir = root_dir.join("generated");
|
||||
let js_dir = generated_dir.join("js");
|
||||
|
||||
leptonic_theme::generate(generated_dir.join("leptonic"));
|
||||
println!("cargo:warning=theme written");
|
||||
|
||||
std::fs::create_dir_all(js_dir.clone()).unwrap();
|
||||
println!("cargo:warning=js dir created");
|
||||
|
||||
std::fs::File::create(js_dir.join("tiptap-bundle.min.js"))
|
||||
.unwrap()
|
||||
.write_all(leptos_tiptap_build::TIPTAP_BUNDLE_MIN_JS.as_bytes())
|
||||
.unwrap();
|
||||
println!("cargo:warning=tiptap-bundle.min.js written");
|
||||
|
||||
std::fs::File::create(js_dir.join("tiptap.js"))
|
||||
.unwrap()
|
||||
.write_all(leptos_tiptap_build::TIPTAP_JS.as_bytes())
|
||||
.unwrap();
|
||||
println!("cargo:warning=tiptap.js written");
|
||||
}
|
27
index.html
Normal file
27
index.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
<meta name="description" content="Leptonic" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#e66956" />
|
||||
|
||||
<title>Leptonic</title>
|
||||
|
||||
<script type="module" src="/js/tiptap-bundle.min.js"></script>
|
||||
<script type="module" src="/js/tiptap.js"></script>
|
||||
|
||||
<!-- <link rel="icon" href="/res/icon/leptonic_x64.png" /> -->
|
||||
|
||||
<link data-trunk rel="rust" data-wasm-opt="z" />
|
||||
<link data-trunk rel="scss" href="scss/style.scss" />
|
||||
<link data-trunk rel="copy-dir" href="generated/js/" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
</html>
|
1
scss/style.scss
Normal file
1
scss/style.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@import "../generated/leptonic/leptonic-themes";
|
11
src/main.rs
Normal file
11
src/main.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use leptonic::prelude::*;
|
||||
use leptos::*;
|
||||
|
||||
#[component]
|
||||
pub fn App(cx: Scope) -> impl IntoView {
|
||||
view! { cx, <Root default_theme=LeptonicTheme::default()>"Content goes here :)"</Root> }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mount_to_body(App)
|
||||
}
|
Loading…
Reference in a new issue