staticweb

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 18 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Static Web

Compile HTML and MD template files together into a static html website.

Installation

# install the go module
go get github.com/tkdeng/staticweb

# or install the binary
git clone https://github.com/tkdeng/staticweb.git &&\
cd staticweb &&\
make install &&\
cd ../ && rm -r staticweb

# install into /usr/bin
make install

# install locally (with dependencies)
make local

# build without dependency installation
make build

# install dependencies
make deps

# uninstall htmlc
make clean

Golang Usage


import (
  "github.com/tkdeng/staticweb"
)

func main(){
  // compile directory
  err := staticweb.Compile("./src", "./dist")

  // compile specific page/directory
  err := staticweb.Compile("./src", "./dist", "/about")

  // compile and watch for file changes
  fileWatcher := staticweb.Live("./src", "./dist", func(err error){
    // handle errors
    fmt.Println(err)
  })
}

Binary Usage

staticweb ./src --out="./dist"

# optional: run live server
staticweb ./src 3000
staticweb ./src --live # default port: 3000

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugMode bool = false
View Source
var TemplateMode bool = false

Functions

func Compile

func Compile(src, dist string, page ...string) error

func Live added in v0.2.0

func Live(src, dist string, handleErr ...func(err error)) *goutil.FSWatcher

Types

type Config

type Config struct {
	Opts map[string]bool
	Vars map[string]string
	Meta map[string]string

	Styles []struct {
		Url   string
		Print bool
		Lazy  bool
	}

	Scripts []struct {
		Url    string
		Module bool
		Defer  bool
		Async  bool
		Wasm   string
	}
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址