shokunin
v0.0.32
用生鏽精心製作的內容優先的靜態站點生成器,優化了性能,可訪問性和搜索引擎可見性。
•網站•文檔•報告錯誤•請求功能•貢獻指南
Shokunin是一種用Rust設計的高性能靜態現場生成器(SSG),優先:
添加到您的Cargo.toml
:
[ dependencies ]
ssg = " 0.0.32 "
或通過貨物安裝:
cargo install ssg
use staticdatagen :: compiler :: service :: compile ;
use std :: { path :: Path , error :: Error } ;
fn main ( ) -> Result < ( ) , Box < dyn Error > > {
// Define directory paths
let build_dir = Path :: new ( "./examples/build" ) ; // Build directory
let content_dir = Path :: new ( "./examples/content" ) ; // Content directory
let public_dir = Path :: new ( "./examples/public" ) ; // Public directory
let template_dir = Path :: new ( "./examples/templates" ) ; // Templates
// Generate site
compile ( build_dir , content_dir , public_dir , template_dir ) ? ;
println ! ( " Site generated successfully!" ) ;
Ok ( ( ) )
}
創建一個新網站:
# Full command syntax
ssg --content=content --template=templates --serve=public
# Short form
ssg -c=content -t=templates -o=output -s=public
# Using cargo run
cargo run --bin ssg -- -c= " ./examples/content " -t= " ./examples/templates " -s= " ./examples/public "
選項 | 短的 | 描述 | 必需的 |
---|---|---|---|
--content | -c | 內容路徑 | 是的 |
--template | -t | 模板路徑 | 是的 |
--serve | -s | 服務器公共路徑 | 是的 |
嘗試我們的示例實現:
# Basic example
# # Convert Markdown to static sites effortlessly, with templates, organized builds, and instant local hosting.
git clone https://github.com/sebastienrousseau/shokunin.git
cd shokunin
cargo run --example basic
# Quick start example
# # Create, compile, and host a static site effortlessly with Shokunin: simple setup, error handling, and instant local server for previews.
cargo run --example quickstart
# Multilingual example
# # Build multilingual static sites effortlessly: generate language-specific sites, create a language selector, and serve all from a single directory.
cargo run --example multilingual
我們歡迎捐款!請參閱我們的貢獻指南,以獲取以下詳細信息:
該項目在以下雙重許可下:
可以選擇。
特別感謝所有幫助建立Shokunin的貢獻者。