分类 默认分类 下的文章

0.安装rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

在中国大陆用替代方法

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh
sed -i 's|static.rust-lang.org|mirrors.ustc.edu.cn/rust-static|g' rust.sh
export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup
chmod a+x rust.sh
./rust.sh

安装完成后

echo "RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup"  >> ~/.cargo/env
  1. 添加wasm编译器
rustup target add wasm32-unknown-unknown

  1. 安装Trunk

Trunk是Sycamore的构建工具,类似于Javascript前端开发中的webpack

cargo install --locked trunk

Sycamore开发团队也在尝试开发专用的构建工具,但目前还是推荐使用 Trunk

  1. 建立一个新的sycamore项目
cargo new hello-sycamore
cd hello-sycamore
cargo add [email protected]

  1. 编辑项目中的 src/main.rs, 用下面的内容完全替代它
use sycamore::prelude::*;

fn main() {
    sycamore::render(|| "Hello, world!".into());
}
  1. 在项目的根目录下创建 index.html, 内容为
<!DOCTYPE html>
<html>
    <head></head>
    <body></body>
</html>
  1. 运行
trunk serve

将会构建你的应用,并在监听在 本机的8080端口,你用浏览器打开 http://localhost:8080 即可看到

这个域名注册于2006年7月19日,当时我在一家芯片公司上班。

最早是用的wordpress,放在Dreamhost上

后来搬迁在namechep的VPS上

2019年迁移到github

2021年用另外一个博客程序,写了两篇文章放在racknerd

2025年用typecho重建,放在cloudflare