8000 GitHub - ugent-library/mix: Package mix implements convenience methods to integrate the Laravel Mix asset bundler in your Go project.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.
/ mix Public archive

Package mix implements convenience methods to integrate the Laravel Mix asset bundler in your Go project.

License

Notifications You must be signed in to change notification settings

ugent-library/mix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference

ugent-library/mix

Package mix implements convenience methods to integrate the Laravel Mix asset bundler in your Go project.

For more information on Laravel Mix, visit the Laravel Mix website.

Install

go get -u github.com/ugent-library/mix

Example

Setup your webpack.mix.js:

const mix = require('laravel-mix')
mix.sass('./assets/css/app.scss', 'css')
mix.setPublicPath('./static')
// ...

And in your Go app:

    // setup file server
    mux := http.NewServeMux()
    mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static"))))

    // setup assets
    assets, err := mix.New(mix.Config{
        ManifestFile: "static/mix-manifest.json",
        PublicPath:   "/static/",
    })
    if err != nil {
        log.Fatal(err)
    }

    // make asset path helper available to templates
    funcs := template.FuncMap{
        "assetPath": assets.AssetPath,
    }

    // ...

About

Package mix implements convenience methods to integrate the Laravel Mix asset bundler in your Go project.

55A6

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0