Add frontend developpement environement

This commit is contained in:
Nicolas Duhamel 2016-05-26 17:17:12 +02:00
parent 1b5326ab75
commit f885486789
8 changed files with 69 additions and 3 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
static
node_modules

View File

@ -24,3 +24,16 @@ make test
``` ```
make clean make clean
``` ```
## Build
```
npm run build
```
## Watch
```
npm run watch
```

6
fontify.json Normal file
View File

@ -0,0 +1,6 @@
{
"modules": [
"bootstrap"
],
"dest": "static"
}

View File

@ -1,6 +1,8 @@
package main package main
import ( import (
"net/http"
"gitlab.quimbo.fr/odwrtw/canape-sql/auth" "gitlab.quimbo.fr/odwrtw/canape-sql/auth"
"gitlab.quimbo.fr/odwrtw/canape-sql/movies" "gitlab.quimbo.fr/odwrtw/canape-sql/movies"
"gitlab.quimbo.fr/odwrtw/canape-sql/users" "gitlab.quimbo.fr/odwrtw/canape-sql/users"
@ -48,6 +50,7 @@ func main() {
n := negroni.Classic() n := negroni.Classic()
n.Use(authMiddleware) n.Use(authMiddleware)
n.Use(negroni.NewStatic(http.Dir("./static")))
n.UseHandler(env.Router) n.UseHandler(env.Router)
n.Run(":3000") n.Run(":3000")
} }

31
package.json Normal file
View File

@ -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"
}
}

4
src/js/app.js Normal file
View File

@ -0,0 +1,4 @@
var $ = require('jquery');
global.jQuery = global.$ = $;
var bootstrap = require('bootstrap');

1
src/less/app.less Normal file
View File

@ -0,0 +1 @@
@import "bootstrap/less/bootstrap.less";

View File

@ -1,10 +1,16 @@
<html> <!DOCTYPE html>
<html lang="en">
<head> <head>
<title>My Layout</title> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Canape</title>
<link href="/css/app.css" rel="stylesheet">
</head> </head>
<body> <body>
{{ yield }} {{ yield }}
<script src="/js/app.js"></script>
</body> </body>
</html> </html>