blob: b7cf0801e83bc783b810eec04c1e20eb311ec7b8 [file] [log] [blame]
Nils Diewaldea236742015-03-26 21:55:36 +00001/*
2 * http://gruntjs.com/getting-started
3 *
Nils Diewalda297f062015-04-02 00:23:46 +00004 * Todo: Move all source files outside the public folder!
Nils Diewalda944fab2015-04-08 21:02:04 +00005 *
Nils Diewaldea236742015-03-26 21:55:36 +00006 * TODO: Use https://www.npmjs.com/package/grunt-contrib-compress
7 * for assets.
8 * http://yui.github.io/yuidoc/
9 * use it with https://www.npmjs.com/package/grunt-contrib-yuidoc
10 *
11 * RequireJS
12 * http://addyosmani.com/writing-modular-js/
13 * http://qnundrum.com/question/393866
14 */
Nils Diewaldea236742015-03-26 21:55:36 +000015module.exports = function(grunt) {
16 grunt.initConfig({
17 pkg: grunt.file.readJSON('package.json'),
18 concat: {
19 dist: {
20 src : [
Nils Diewalda944fab2015-04-08 21:02:04 +000021 'dev/js/lib/dagre/dagre.min.js',
22 'dev/js/src/menu.js',
23 'dev/js/src/match.js',
24 'dev/js/src/hint.js',
25 'dev/js/src/vc.js',
26 'dev/js/src/api.js',
27 'dev/js/src/session.js',
28 'dev/js/src/tutorial.js',
29 'dev/js/src/util.js'
Nils Diewaldea236742015-03-26 21:55:36 +000030 ],
Nils Diewalda944fab2015-04-08 21:02:04 +000031 dest: 'dev/js/build/kalamar.js'
Nils Diewaldea236742015-03-26 21:55:36 +000032 }
33 },
34 uglify : {
35 build : {
Nils Diewalda944fab2015-04-08 21:02:04 +000036 src: 'dev/js/build/kalamar.js',
37 dest: 'public/js/kalamar-<%= pkg.version %>.js'
Nils Diewaldea236742015-03-26 21:55:36 +000038 }
39 },
40 imagemin: {
41 dynamic: {
42 files: [{
43 expand: true,
Nils Diewalda944fab2015-04-08 21:02:04 +000044 cwd: 'dev/img/',
Nils Diewalda297f062015-04-02 00:23:46 +000045 src: ['*.{png,gif,jpg,svg}'],
Nils Diewalda944fab2015-04-08 21:02:04 +000046 dest: 'public/img/'
Nils Diewaldea236742015-03-26 21:55:36 +000047 }]
48 }
49 },
50 sass: {
51 dist: {
52 options: {
53 style: 'compressed'
54 },
55 files: {
Nils Diewalda944fab2015-04-08 21:02:04 +000056 'public/css/kalamar-<%= pkg.version %>.css' : 'dev/scss/kalamar.scss'
Nils Diewaldea236742015-03-26 21:55:36 +000057 }
58 }
59 },
Nils Diewalda297f062015-04-02 00:23:46 +000060 jasmine: {
61 pivotal: {
62 src: [
Nils Diewalda944fab2015-04-08 21:02:04 +000063 'dev/js/src/menu.js',
64 'dev/js/src/match.js',
65 'dev/js/src/match.js',
66 'dev/js/src/vc.js'
Nils Diewalda297f062015-04-02 00:23:46 +000067 ],
68 options: {
Nils Diewalda944fab2015-04-08 21:02:04 +000069 specs: 'dev/js/spec/*Spec.js'
Nils Diewalda297f062015-04-02 00:23:46 +000070 }
71 }
72 },
Nils Diewaldea236742015-03-26 21:55:36 +000073 watch: {
74/*
75 options: {
76 livereload: true
77 },
78 scripts: {
79 files: ['js/*.js'],
80 tasks: ['concat', 'uglify'],
81 options: {
82 spawn: false
83 },
84 },
85*/
86 css: {
Nils Diewalda944fab2015-04-08 21:02:04 +000087 files: ['dev/scss/{util,fonts,base,header,searchbar,matchinfo,resultinfo,kwic,menu,hint,pagination,logos,alertify,vc,media,kalamar,tutorial,query,sidebar}.scss'],
Nils Diewaldea236742015-03-26 21:55:36 +000088 tasks: ['sass'],
89 options: {
90 spawn: false
91 }
92 }
93 }
94 });
95
96 grunt.loadNpmTasks('grunt-contrib-concat');
97 grunt.loadNpmTasks('grunt-contrib-uglify');
98 grunt.loadNpmTasks('grunt-contrib-imagemin');
99 grunt.loadNpmTasks('grunt-contrib-watch');
100 grunt.loadNpmTasks('grunt-contrib-sass');
Nils Diewalda297f062015-04-02 00:23:46 +0000101 grunt.loadNpmTasks('grunt-contrib-jasmine');
Nils Diewaldea236742015-03-26 21:55:36 +0000102 grunt.registerTask('css', ['sass']);
103 grunt.registerTask('default', ['concat', 'uglify', 'imagemin', 'sass']);
104};