blob: 510bb448ebe77612a9667bce9ef86a3fa6cd73b4 [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 Diewaldaa17d142015-04-08 23:32:23 +000074 // see https://github.com/gruntjs/grunt-contrib-copy/issues/64
Nils Diewaldce328112015-04-08 22:48:18 +000075 copy : {
Nils Diewaldaa17d142015-04-08 23:32:23 +000076 options: {
77 process:false
78 },
79 main: {
80 files:[
81 {
82 expand: true,
83 cwd: 'dev/font/',
84 src: '**',
85 dest: 'public/font/',
86 filter: 'isFile',
87 nonull: true,
88 timestamp: true
89 },
90 {
91 expand: true,
92 cwd: 'dev/img/',
93 src: 'favicon.ico',
94 dest: 'public/',
95 nonull:true,
96 timestamp:true
97 }
98 ]
99 }
Nils Diewaldce328112015-04-08 22:48:18 +0000100 },
Nils Diewaldea236742015-03-26 21:55:36 +0000101 watch: {
102/*
103 options: {
104 livereload: true
105 },
106 scripts: {
107 files: ['js/*.js'],
108 tasks: ['concat', 'uglify'],
109 options: {
110 spawn: false
111 },
112 },
113*/
114 css: {
Nils Diewalda944fab2015-04-08 21:02:04 +0000115 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 +0000116 tasks: ['sass'],
117 options: {
118 spawn: false
119 }
120 }
121 }
122 });
123
124 grunt.loadNpmTasks('grunt-contrib-concat');
125 grunt.loadNpmTasks('grunt-contrib-uglify');
126 grunt.loadNpmTasks('grunt-contrib-imagemin');
127 grunt.loadNpmTasks('grunt-contrib-watch');
128 grunt.loadNpmTasks('grunt-contrib-sass');
Nils Diewalda297f062015-04-02 00:23:46 +0000129 grunt.loadNpmTasks('grunt-contrib-jasmine');
Nils Diewaldce328112015-04-08 22:48:18 +0000130 grunt.loadNpmTasks('grunt-contrib-copy');
Nils Diewaldea236742015-03-26 21:55:36 +0000131 grunt.registerTask('css', ['sass']);
Nils Diewaldce328112015-04-08 22:48:18 +0000132 grunt.registerTask(
133 'default',
134 ['copy', 'concat', 'uglify', 'imagemin', 'sass']
135 );
Nils Diewaldea236742015-03-26 21:55:36 +0000136};