Add go-bindata assets

This commit is contained in:
Ivan Danyliuk 2018-08-03 08:10:18 +02:00
parent ec8964fce7
commit ae85073d7e
No known key found for this signature in database
GPG Key ID: 97ED33CE024E1DBF
3 changed files with 391 additions and 3 deletions

385
assets.go Normal file

File diff suppressed because one or more lines are too long

7
web.go
View File

@ -1,8 +1,10 @@
//go:generate browserify web/index.js web/js/ws.js -o web/bundle.js
//go:generate $GOPATH/bin/go-bindata -nocompress=false -nomemcopy=true -prefix=web -o "assets.go" web/index.html web/bundle.js web/node_modules/three/build/three.min.js web/js/controls web/css/...
package main
import (
"fmt"
"github.com/elazarl/go-bindata-assetfs"
"log"
"net/http"
"os/exec"
@ -11,8 +13,9 @@ import (
func startWeb(ws *WSServer, port string) {
go func() {
fs := http.FileServer(http.Dir("web"))
http.Handle("/", noCacheMiddleware(fs))
// Handle static files
fs := &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: ""}
http.Handle("/", noCacheMiddleware(http.FileServer(fs)))
http.HandleFunc("/ws", ws.Handle)
log.Fatal(http.ListenAndServe(port, nil))
}()

View File

@ -1,4 +1,4 @@
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var { colorStr2Hex, autoColorNodes } = require('./js/colors.js');
require('./js/keys.js');
var accessorFn = require('./js/shitty_hacks.js');