govite

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 8 Imported by: 0

README

go-vite

Vite Adapter in go

How to use

  1. install this plugins: vite-plugin-dev-manifest in package.json
  2. add the vite-plugin-dev-manifest to vite.config and enable manifest generation.
    import {defineConfig} from "vite";
    import devManifest from 'vite-plugin-dev-manifest';
    
    export default defineConfig({
        plugins: [
            //.. add your other plugins here ..
            devManifest(),
        ],
        build: {
        // generate .vite/manifest.json in outDir
        manifest: true,
        rollupOptions: {
                // your scripts
                input: './main.js',
            },
        },
    })
    
  3. to implement the server you can see the example at example/simple-vite-project/server.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ViteOutputPath string
	AssetBaseUrl   string
}

type ViteAdapter

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

func New

func New(cfg *Config) *ViteAdapter

func NewWithFS added in v0.0.2

func NewWithFS(cfg *Config, fs fs.FS) *ViteAdapter

func (*ViteAdapter) FileServer added in v0.0.2

func (v *ViteAdapter) FileServer() http.Handler

func (*ViteAdapter) GetBuilder

func (v *ViteAdapter) GetBuilder() (VitePageAssetsBuilder, error)

func (*ViteAdapter) MustGetBuilder

func (v *ViteAdapter) MustGetBuilder() VitePageAssetsBuilder

type VitePageAssetsBuilder

type VitePageAssetsBuilder interface {
	CreateStyleTags() string
	CreateScriptTags() string
	CreatePreloadTags() string

	AddAsset(assetFile string) VitePageAssetsBuilder
}

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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