dev

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIB_PATH = "static/gen/lib"
	ESM_PATH = "static/gen/esm"
)
View Source
const (
	// TODO: allow custom config file to be specified
	TAILWIND_CONFIG_FILE     = "tailwind.config.js"
	TAILWIND_CONFIG_CONTENTS = `
	module.exports = {
		content: [%s],
		theme: {
		  extend: {},
		},
	  
		plugins: [
		  %s
		],
		%s
	}`

	TAILWIND_INPUT_CONTENTS = `
	@tailwind base;
	@tailwind components;
	@tailwind utilities;
	`
)
View Source
const (
	STYLE_FILE_PATH = "static/gen/css/style.css"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppDev

type AppDev struct {
	*utils.Logger

	CustomLayout bool
	Config       *util.AppConfig

	AppStyle *AppStyle

	JsLibs []JSLibrary
	// contains filtered or unexported fields
}

AppDev is the main object that represents a Clace app in dev mode. It is created when the app is loaded with is_dev true and handles the styling and js library related functionalities. Access to this is synced through the initMutex in App. The reload method in App is the main access point to this object

func NewAppDev

func NewAppDev(logger *utils.Logger, sourceFS *util.WritableSourceFs, workFS *util.WorkFs, systemConfig *utils.SystemConfig) *AppDev

func (*AppDev) Close

func (a *AppDev) Close() error

Close the app dev session

func (*AppDev) GenerateHTML

func (a *AppDev) GenerateHTML() error

GenerateHTML generates the default HTML template files for the app.

func (*AppDev) SaveConfigLockFile

func (a *AppDev) SaveConfigLockFile() error

func (*AppDev) SetupJsLibs

func (a *AppDev) SetupJsLibs() error

SetupJsLibs sets up the js libraries for the app.

type AppStyle

type AppStyle struct {
	DisableWatcher bool
	// contains filtered or unexported fields
}

AppStyle is the style related configuration and state for an app. It is created when the App is loaded. It keeps track of the watcher process required to rebuild the CSS file when the tailwind/daisy config changes. The reload mutex lock in App is used to ensure only one call to the watcher is done at a time, no locking is implemented in AppStyle

func (*AppStyle) Init

func (s *AppStyle) Init(appId utils.AppId, appDef *starlarkstruct.Struct) error

Init initializes the AppStyle object from the app definition

func (*AppStyle) Setup

func (s *AppStyle) Setup(dev *AppDev) error

Setup sets up the style library for the app. This is called when the app is reloaded.

func (*AppStyle) StartWatcher

func (s *AppStyle) StartWatcher(dev *AppDev) error

StartWatcher starts the watcher process for the app. This is called when the app is reloaded.

func (*AppStyle) StopWatcher

func (s *AppStyle) StopWatcher() error

type JSLibrary

type JSLibrary struct {
	// contains filtered or unexported fields
}

JSLibrary handles the downloading for JS libraries and esbuild based bundling for ESM libraries

func NewLibrary

func NewLibrary(url string) *JSLibrary

func NewLibraryESM

func NewLibraryESM(packageName string, version string, esbuildArgs []string) *JSLibrary

func (*JSLibrary) Setup

func (j *JSLibrary) Setup(dev *AppDev, sourceFS *util.WritableSourceFs, workFS *util.WorkFs) (string, error)

type LibraryType

type LibraryType string
const (
	ESModule LibraryType = "ecmascript_module"
	Library  LibraryType = "library"
)

type StyleType

type StyleType string

StyleType is the type of style library used by the app

const (
	TailwindCSS StyleType = "tailwindcss"
	DaisyUI     StyleType = "daisyui"
	Other       StyleType = "other"
	None        StyleType = ""
)

type WatcherState

type WatcherState struct {
	// contains filtered or unexported fields
}

WatcherState is the state of the watcher process as of when it was last started.

Jump to

Keyboard shortcuts

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