This commit is contained in:
Nils Schneider 2015-03-29 14:43:02 +02:00
parent 661a402b37
commit bfe6fe346d
8 changed files with 189 additions and 1 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
bower_components/
app-combined.js
node_modules/
build/

10
Gruntfile.js Normal file
View file

@ -0,0 +1,10 @@
"use strict"
module.exports = function (grunt) {
grunt.loadTasks("tasks")
grunt.registerTask("default", ["lint", "copy", "cssmin", "requirejs"])
grunt.registerTask("lint", ["eslint"])
grunt.registerTask("dev", ["default", "connect:server", "watch"])
}

15
html/index.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="css/ionicons.min.css">
<link rel="stylesheet" href="roboto-slab-fontface.css">
<link rel="stylesheet" href="style.css">
<script src="vendor/es6-shim/es6-shim.min.js"></script>
<script src="vendor/intl/Intl.complete.js"></script>
<script src="app.js"></script>
</head>
<body>
</body>
</html>

18
package.json Normal file
View file

@ -0,0 +1,18 @@
{
"name": "meshviewer",
"scripts": {
"test": "node -e \"require('grunt').cli()\" '' clean lint"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-check-dependencies": "^0.6.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "^0.8.0",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.12.2",
"grunt-contrib-requirejs": "^0.4.4",
"grunt-contrib-uglify": "^0.5.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-eslint": "^1.1.0"
}
}

65
tasks/build.js Normal file
View file

@ -0,0 +1,65 @@
"use strict"
module.exports = function(grunt) {
grunt.config.merge({
copy: {
html: {
src: ["*.html"],
expand: true,
cwd: "html/",
dest: "build/"
},
vendorjs: {
src: [ "es6-shim/es6-shim.min.js",
"intl/Intl.complete.js"
],
expand: true,
cwd: "bower_components/",
dest: "build/vendor/"
},
roboto: {
src: [ "fonts/*",
"roboto-slab-fontface.css"
],
expand: true,
dest: "build/",
cwd: "bower_components/roboto-slab-fontface"
},
ionicons: {
src: [ "fonts/*",
"css/ionicons.min.css"
],
expand: true,
dest: "build/",
cwd: "bower_components/ionicons/",
}
},
cssmin: {
target: {
files: {
"build/style.css": [ "bower_components/leaflet/dist/leaflet.css",
"bower_components/Leaflet.label/dist/leaflet.label.css",
"style.css"
]
}
}
},
requirejs: {
compile: {
options: {
baseUrl: "lib",
name: "../bower_components/almond/almond",
mainConfigFile: "app.js",
include: "../app",
wrap: true,
optimize: "uglify",
out: "build/app.js"
}
}
}
})
grunt.loadNpmTasks("grunt-contrib-copy")
grunt.loadNpmTasks("grunt-contrib-requirejs")
grunt.loadNpmTasks('grunt-contrib-cssmin')
}

11
tasks/clean.js Normal file
View file

@ -0,0 +1,11 @@
"use strict"
module.exports = function (grunt) {
grunt.config.merge({
clean: {
build: ["build/**/*", "node_modules/grunt-newer/.cache"]
}
})
grunt.loadNpmTasks("grunt-contrib-clean")
}

33
tasks/development.js Normal file
View file

@ -0,0 +1,33 @@
"use strict"
module.exports = function (grunt) {
grunt.config.merge({
connect: {
server: {
options: {
base: "build/", //TODO: once grunt-contrib-connect 0.9 is released, set index file
livereload: true
}
}
},
watch: {
sources: {
options: {
livereload: true
},
files: ["*.css", "app.js", "lib/*.js", "*.html"],
tasks: ["default"]
},
config: {
options: {
reload: true
},
files: ["Gruntfile.js", "tasks/*.js"],
tasks: []
}
}
})
grunt.loadNpmTasks("grunt-contrib-connect")
grunt.loadNpmTasks("grunt-contrib-watch")
}

35
tasks/linting.js Normal file
View file

@ -0,0 +1,35 @@
"use strict"
module.exports = function (grunt) {
grunt.config.merge({
checkDependencies: {
options: {
install: true
},
bower: {
options: {
packageManager: "bower"
}
},
npm: {}
},
eslint: {
options: {
rule: {
semi: [2, "never"],
strict: [2, "never"],
curly: [2, "multi"]
}
},
sources: {
src: ["app.js", "!Gruntfile.js", "lib/*.js"]
},
grunt: {
src: ["Gruntfile.js", "tasks/*.js"]
}
}
})
grunt.loadNpmTasks("grunt-check-dependencies")
grunt.loadNpmTasks("grunt-eslint")
}