blob: 5a7ac890fecaab1ca006adf8a3eddad154840e0c [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 Diewaldce328112015-04-08 22:48:18 +000056 'public/css/kalamar-<%= pkg.version %>.css' : 'dev/scss/kalamar.scss',
57 'dev/css/kalamar.css' : 'dev/scss/kalamar.scss'
Nils Diewaldea236742015-03-26 21:55:36 +000058 }
59 }
60 },
Nils Diewalda297f062015-04-02 00:23:46 +000061 jasmine: {
62 pivotal: {
63 src: [
Nils Diewalda944fab2015-04-08 21:02:04 +000064 'dev/js/src/menu.js',
65 'dev/js/src/match.js',
66 'dev/js/src/match.js',
67 'dev/js/src/vc.js'
Nils Diewalda297f062015-04-02 00:23:46 +000068 ],
69 options: {
Nils Diewalda944fab2015-04-08 21:02:04 +000070 specs: 'dev/js/spec/*Spec.js'
Nils Diewalda297f062015-04-02 00:23:46 +000071 }
72 }
73 },
Nils Diewaldce328112015-04-08 22:48:18 +000074 copy : {
75 src: 'dev/font/**',
76 dest: 'public/font/',
77 nonull: true,
78 timestamp: true
79 },
Nils Diewaldea236742015-03-26 21:55:36 +000080 watch: {
81/*
82 options: {
83 livereload: true
84 },
85 scripts: {
86 files: ['js/*.js'],
87 tasks: ['concat', 'uglify'],
88 options: {
89 spawn: false
90 },
91 },
92*/
93 css: {
Nils Diewalda944fab2015-04-08 21:02:04 +000094 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 +000095 tasks: ['sass'],
96 options: {
97 spawn: false
98 }
99 }
100 }
101 });
102
103 grunt.loadNpmTasks('grunt-contrib-concat');
104 grunt.loadNpmTasks('grunt-contrib-uglify');
105 grunt.loadNpmTasks('grunt-contrib-imagemin');
106 grunt.loadNpmTasks('grunt-contrib-watch');
107 grunt.loadNpmTasks('grunt-contrib-sass');
Nils Diewalda297f062015-04-02 00:23:46 +0000108 grunt.loadNpmTasks('grunt-contrib-jasmine');
Nils Diewaldce328112015-04-08 22:48:18 +0000109 grunt.loadNpmTasks('grunt-contrib-copy');
Nils Diewaldea236742015-03-26 21:55:36 +0000110 grunt.registerTask('css', ['sass']);
Nils Diewaldce328112015-04-08 22:48:18 +0000111 grunt.registerTask(
112 'default',
113 ['copy', 'concat', 'uglify', 'imagemin', 'sass']
114 );
Nils Diewaldea236742015-03-26 21:55:36 +0000115};