freifunkmanager/Gruntfile.js

113 lines
1.9 KiB
JavaScript
Raw Normal View History

2016-07-01 16:01:28 +02:00
"use strict";
2016-07-01 08:25:32 +02:00
module.exports = function (grunt) {
// Load grunt tasks automatically, when needed
2016-07-01 16:01:28 +02:00
require("jit-grunt")(grunt, {
useminPrepare: "grunt-usemin",
2016-07-01 08:25:32 +02:00
});
2016-07-01 16:01:28 +02:00
require("time-grunt")(grunt);
2016-07-01 08:25:32 +02:00
grunt.initConfig({
open: {
public: {
2016-07-01 16:01:28 +02:00
url: "http://localhost:8080"
2016-07-01 08:25:32 +02:00
}
},
connect:{
public:{
options:{
port:8080,
2016-07-01 16:01:28 +02:00
hostname:"*",
base:["."]
2016-07-01 08:25:32 +02:00
}
}
},
jshint: {
2016-07-01 16:01:28 +02:00
files: ["js/**/*.js"],
2016-07-01 08:25:32 +02:00
options: {
2016-07-01 16:01:28 +02:00
reporter: require("jshint-stylish")
2016-07-01 08:25:32 +02:00
}
},
watch: {
livereload: {
files: [
2016-07-01 16:01:28 +02:00
"js/**/*.js",
"css/**/*.css",
2016-07-01 08:25:32 +02:00
],
options: {
livereload: true
}
}
2016-07-01 16:01:28 +02:00
},
clean: {
build: {
files: [{
dot: true,
src: [
"build/*",
"!build/.git*",
]
}]
}
},
copy: {
html: {
options: {
process: function (content) {
return content.replace("#revision#", grunt.option("gitRevision"))
}
},
src: ["*.html"],
expand: true,
cwd: "html/",
dest: "build/"
},
font: {
src: ["fonts/*"],
dest: "build/"
},
favicon: {
src: ["favicon*"],
dest: "build/"
},
config: {
src: [ "config*.example" ],
expand: true,
dest: "build/"
}
},
cssmin: {
target: {
files: {
"build/css/style.css": [ "bower_components/leaflet/dist/leaflet.css",
"bower_components/Leaflet.label/dist/leaflet.label.css",
"css/**/*.css"
]
}
}
},
requirejs: {
compile: {
options: {
baseUrl: "js",
name: "../node_modules/almond/almond",
mainConfigFile: "js/app.js",
include: "app",
wrap: true,
optimize: "uglify",
out: "build/app.js"
}
}
2016-07-01 08:25:32 +02:00
}
});
2016-07-01 16:01:28 +02:00
grunt.registerTask("build",[
"jshint",
"clean",
"copy",
"cssmin",
"requirejs:compile"
]);
grunt.registerTask("default", ["connect:public","open:public","watch"]);
2016-07-01 08:25:32 +02:00
};