mirror of
https://github.com/owenthereal/jqplay.git
synced 2025-04-19 06:02:17 +03:00
Embed assets
This commit is contained in:
parent
e99aba7aef
commit
b1cf816fd1
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,9 +1,6 @@
|
||||
gin-bin
|
||||
node_modules
|
||||
public/bower_components
|
||||
public/css
|
||||
public/js
|
||||
public/index.tmpl
|
||||
/public
|
||||
assets/tmp
|
||||
.env
|
||||
*.c.out
|
||||
|
13
.travis.yml
13
.travis.yml
@ -1,13 +0,0 @@
|
||||
sudo: false
|
||||
language: go
|
||||
go:
|
||||
- 1.11.1
|
||||
env:
|
||||
- TRAVIS_NODE_VERSION="7"
|
||||
install:
|
||||
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
|
||||
script:
|
||||
- bin/build
|
||||
- bin/test
|
||||
notifications:
|
||||
email: false
|
@ -1,6 +1,6 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.loadTasks('tasks');
|
||||
grunt.registerTask('build', "Builds the application.",
|
||||
['clean', 'concat', 'cssmin', 'uglify', 'replace']);
|
||||
['clean', 'concat', 'cssmin', 'copy', 'uglify', 'replace']);
|
||||
grunt.option('ts', new Date().getTime());
|
||||
}
|
||||
|
2
Makefile
2
Makefile
@ -3,8 +3,8 @@ SHELL=/bin/bash -o pipefail
|
||||
GOBIN ?= $(CURDIR)/build
|
||||
.PHONY: build
|
||||
build:
|
||||
yarn
|
||||
go build -o $(GOBIN)/jqplay ./cmd/jqplay
|
||||
npm install
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
|
BIN
assets/images/favicon.png
Normal file
BIN
assets/images/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/images/logo.png
Executable file
BIN
assets/images/logo.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -160,7 +160,7 @@
|
||||
|
||||
<footer class="footer">
|
||||
<hr>
|
||||
<p><a href="https://github.com/jingweno/jqplay">View source</a> on GitHub</p>
|
||||
<p><a href="https://github.com/owenthereal/jqplay">View source</a> on GitHub</p>
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
|
2
assets/robots.txt
Normal file
2
assets/robots.txt
Normal file
@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Allow: /
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "jqplay",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"angular": "1.6.6",
|
||||
"bootstrap": "3.3.7",
|
||||
"angular-ui-ace": "0.2.3"
|
||||
}
|
||||
}
|
6
embed.go
Normal file
6
embed.go
Normal file
@ -0,0 +1,6 @@
|
||||
package jqplay
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed all:public
|
||||
var PublicFS embed.FS
|
4149
package-lock.json
generated
4149
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -22,9 +22,17 @@
|
||||
"grunt-contrib-cssmin": "^3.0.0",
|
||||
"grunt-contrib-uglify": "^2.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-text-replace": "^0.4.0"
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
"@bower_components/ace-builds": "ajaxorg/ace-builds#^1",
|
||||
"@bower_components/angular": "angular/bower-angular#1.6.6",
|
||||
"@bower_components/angular-ui-ace": "angular-ui/ui-ace#0.2.3",
|
||||
"@bower_components/bootstrap": "twbs/bootstrap#3.3.7",
|
||||
"@bower_components/jquery": "jquery/jquery-dist#1.9.1 - 3"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "bower install && rm -rf public/bower_components/ace-builds/demo/kitchen-sink/docs && grunt build"
|
||||
"postinstall": "node -e \"try { require('fs').symlinkSync(require('path').resolve('node_modules/@bower_components'), 'public/bower_components', 'junction') } catch (e) { }\" && grunt build"
|
||||
},
|
||||
"engines": {
|
||||
"yarn": ">= 1.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ type JQHandlerContext struct {
|
||||
}
|
||||
|
||||
func (c *JQHandlerContext) Asset(path string) string {
|
||||
return fmt.Sprintf("%s/%s", c.AssetHost, path)
|
||||
return fmt.Sprintf("%s/assets/public/%s", c.AssetHost, path)
|
||||
}
|
||||
|
||||
func (c *JQHandlerContext) ShouldInitJQ() bool {
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/oklog/run"
|
||||
"github.com/owenthereal/jqplay"
|
||||
"github.com/owenthereal/jqplay/config"
|
||||
"github.com/owenthereal/jqplay/server/middleware"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -71,13 +72,7 @@ func newHTTPServer(cfg *config.Config, db *DB) (*http.Server, error) {
|
||||
)
|
||||
router.SetHTMLTemplate(tmpl)
|
||||
|
||||
router.Static("/js", "public/js")
|
||||
router.Static("/css", "public/css")
|
||||
router.Static("/images", "public/images")
|
||||
router.Static("/fonts", "public/bower_components/bootstrap/dist/fonts")
|
||||
router.StaticFile("/worker-xquery.js", "public/bower_components/ace-builds/src-min-noconflict/worker-xquery.js")
|
||||
router.StaticFile("/robots.txt", "public/robots.txt")
|
||||
|
||||
router.StaticFS("/assets", http.FS(jqplay.PublicFS))
|
||||
router.GET("/", h.handleIndex)
|
||||
router.GET("/jq", h.handleJqGet)
|
||||
router.POST("/jq", h.handleJqPost)
|
||||
|
@ -1,7 +1,6 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.config('clean', {
|
||||
js: [ 'public/js/*.js' ],
|
||||
css: [ 'public/css/*.css' ]
|
||||
pubic: [ 'public/*' ]
|
||||
});
|
||||
}
|
||||
|
@ -3,19 +3,19 @@ module.exports = function(grunt) {
|
||||
grunt.config('concat', {
|
||||
css: {
|
||||
src: [
|
||||
'public/bower_components/bootstrap/dist/css/bootstrap.css',
|
||||
'node_modules/@bower_components/bootstrap/dist/css/bootstrap.css',
|
||||
'assets/css/app.css'
|
||||
],
|
||||
dest: 'assets/tmp/app.css'
|
||||
},
|
||||
js: {
|
||||
src: [
|
||||
'public/bower_components/ace-builds/src-noconflict/ace.js',
|
||||
'public/bower_components/ace-builds/src-noconflict/ext-searchbox.js',
|
||||
'public/bower_components/ace-builds/src-noconflict/theme-github.js',
|
||||
'public/bower_components/ace-builds/src-noconflict/mode-jsoniq.js',
|
||||
'public/bower_components/angular/angular.js',
|
||||
'public/bower_components/angular-ui-ace/ui-ace.js',
|
||||
'node_modules/@bower_components/ace-builds/src-noconflict/ace.js',
|
||||
'node_modules/@bower_components/ace-builds/src-noconflict/ext-searchbox.js',
|
||||
'node_modules/@bower_components/ace-builds/src-noconflict/theme-github.js',
|
||||
'node_modules/@bower_components/ace-builds/src-noconflict/mode-jsoniq.js',
|
||||
'node_modules/@bower_components/angular/angular.js',
|
||||
'node_modules/@bower_components/angular-ui-ace/ui-ace.js',
|
||||
'assets/js/app.js',
|
||||
'assets/js/controllers.js',
|
||||
'assets/js/services.js',
|
||||
|
@ -1,14 +1,19 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.config('copy', {
|
||||
scripts: {
|
||||
fonts: {
|
||||
files: [
|
||||
{expand: true, flatten: true, src: 'assets/tmp/**/*.js', dest: 'public/js/'}
|
||||
{expand: true, flatten: true, src: 'node_modules/@bower_components/bootstrap/dist/fonts/*.*', dest: 'public/fonts/'}
|
||||
]
|
||||
},
|
||||
css: {
|
||||
images: {
|
||||
files: [
|
||||
{expand: true, flatten: true, src: 'assets/css/**/*.css', dest: 'public/css/'}
|
||||
{expand: true, flatten: true, src: 'assets/images/*.*', dest: 'public/images/'}
|
||||
]
|
||||
},
|
||||
"robot.txt": {
|
||||
files: [
|
||||
{expand: true, flatten: true, src: 'assets/robots.txt', dest: 'public/'}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user