diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a904651 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +static +node_modules diff --git a/README.md b/README.md index 0b9ea33..05b670f 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,16 @@ make test ``` make clean ``` + +## Build + +``` +npm run build + +``` + +## Watch + +``` +npm run watch +``` diff --git a/fontify.json b/fontify.json new file mode 100644 index 0000000..86b8b30 --- /dev/null +++ b/fontify.json @@ -0,0 +1,6 @@ +{ + "modules": [ + "bootstrap" + ], + "dest": "static" +} diff --git a/main.go b/main.go index 6d17083..6cc9250 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,8 @@ package main import ( + "net/http" + "gitlab.quimbo.fr/odwrtw/canape-sql/auth" "gitlab.quimbo.fr/odwrtw/canape-sql/movies" "gitlab.quimbo.fr/odwrtw/canape-sql/users" @@ -48,6 +50,7 @@ func main() { n := negroni.Classic() n.Use(authMiddleware) + n.Use(negroni.NewStatic(http.Dir("./static"))) n.UseHandler(env.Router) n.Run(":3000") } diff --git a/package.json b/package.json new file mode 100644 index 0000000..65c6f3b --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "name": "canape", + "version": "0.0.1", + "description": "``` make dev ```", + "main": "index.js", + "scripts": { + "build-js": "mkdir -p ./static/js & nodejs node_modules/.bin/browserify src/js/app.js -o static/js/app.js", + "build-less": "mkdir -p ./static/css & nodejs ./node_modules/.bin/lessc --include-path=./node_modules src/less/app.less static/css/app.css", + "build-font": "mkdir ./static & nodejs ./node_modules/.bin/fontify", + "watch-js": "nodejs ./node_modules/.bin/nodemon -e js -w src/js/app.js -x 'npm run build-js'", + "watch-less": "nodejs ./node_modules/.bin/nodemon -e less -w src/less/app.less -x 'npm run build-less'", + "build": "npm run build-js & npm run build-less & npm run build-font", + "watch": "npm run watch-js & npm run watch-less" + }, + "repository": { + "type": "git", + "url": "ssh://git@gitlab.quimbo.fr:5022/odwrtw/canape-sql.git" + }, + "author": "", + "license": "ISC", + "dependencies": { + "bootstrap": "^3.3.6", + "jquery": "^2.2.4" + }, + "devDependencies": { + "browserify": "^13.0.1", + "fontify": "0.0.2", + "less": "^2.7.1", + "nodemon": "^1.9.2" + } +} diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..650139d --- /dev/null +++ b/src/js/app.js @@ -0,0 +1,4 @@ +var $ = require('jquery'); +global.jQuery = global.$ = $; + +var bootstrap = require('bootstrap'); diff --git a/src/less/app.less b/src/less/app.less new file mode 100644 index 0000000..b22b632 --- /dev/null +++ b/src/less/app.less @@ -0,0 +1 @@ +@import "bootstrap/less/bootstrap.less"; diff --git a/templates/layout.tmpl b/templates/layout.tmpl index fe84f02..4ce3170 100644 --- a/templates/layout.tmpl +++ b/templates/layout.tmpl @@ -1,10 +1,16 @@ - + +
-