blob: 3cf82bb7557f7a5d6aedd94c6a0477854bcb968b [file] [log] [blame]
Nils Diewald2488d052015-04-09 21:46:02 +00001/**
2 * Grunt build file for Kalamar.
3 * Create assets (based on files in /dev) running
4 * $ grunt
5 * in the current folder.
6 *
7 * @author Nils Diewald
8 */
Nils Diewaldea236742015-03-26 21:55:36 +00009/*
Nils Diewaldea236742015-03-26 21:55:36 +000010 * TODO: Use https://www.npmjs.com/package/grunt-contrib-compress
Nils Diewald2488d052015-04-09 21:46:02 +000011 * for assets.
12 * http://yui.github.io/yuidoc/
13 * TODO: Use https://www.npmjs.com/package/grunt-contrib-yuidoc
Nils Diewald4c221252015-04-21 20:19:25 +000014 * TODO: Implement a LaTeX generator for a pdf of the dokumentation
Nils Diewaldea236742015-03-26 21:55:36 +000015 */
Nils Diewaldea236742015-03-26 21:55:36 +000016module.exports = function(grunt) {
17 grunt.initConfig({
18 pkg: grunt.file.readJSON('package.json'),
Nils Diewald0e6992a2015-04-14 20:13:52 +000019 requirejs: {
20 compile: {
21 options: {
22 // optimize: "uglify",
23 baseUrl: 'dev/js/src',
24 paths : {
25 'lib': '../lib'
26 },
27 wrap:true,
Nils Diewald7c8ced22015-04-15 19:21:00 +000028 include : ['app'],
29 insertRequire: ['app'],
Nils Diewald0e6992a2015-04-14 20:13:52 +000030 name: 'lib/almond',
31 out: 'public/js/kalamar-<%= pkg.version %>.js'
32 }
33 }
34 },
Nils Diewaldea236742015-03-26 21:55:36 +000035 imagemin: {
36 dynamic: {
37 files: [{
38 expand: true,
Nils Diewalda944fab2015-04-08 21:02:04 +000039 cwd: 'dev/img/',
Nils Diewalda297f062015-04-02 00:23:46 +000040 src: ['*.{png,gif,jpg,svg}'],
Nils Diewalda944fab2015-04-08 21:02:04 +000041 dest: 'public/img/'
Nils Diewaldea236742015-03-26 21:55:36 +000042 }]
43 }
44 },
45 sass: {
46 dist: {
47 options: {
48 style: 'compressed'
49 },
50 files: {
Nils Diewaldce328112015-04-08 22:48:18 +000051 'public/css/kalamar-<%= pkg.version %>.css' : 'dev/scss/kalamar.scss',
52 'dev/css/kalamar.css' : 'dev/scss/kalamar.scss'
Nils Diewaldea236742015-03-26 21:55:36 +000053 }
54 }
55 },
Nils Diewalda297f062015-04-02 00:23:46 +000056 jasmine: {
57 pivotal: {
58 src: [
Nils Diewalda944fab2015-04-08 21:02:04 +000059 'dev/js/src/menu.js',
60 'dev/js/src/match.js',
Nils Diewalda1228622015-04-25 01:59:10 +000061 'dev/js/src/hint.js',
Nils Diewalda944fab2015-04-08 21:02:04 +000062 'dev/js/src/vc.js'
Nils Diewalda297f062015-04-02 00:23:46 +000063 ],
64 options: {
Nils Diewalda944fab2015-04-08 21:02:04 +000065 specs: 'dev/js/spec/*Spec.js'
Nils Diewalda297f062015-04-02 00:23:46 +000066 }
67 }
68 },
Nils Diewaldaa17d142015-04-08 23:32:23 +000069 // see https://github.com/gruntjs/grunt-contrib-copy/issues/64
Nils Diewald2488d052015-04-09 21:46:02 +000070 // for copying binary files
Nils Diewaldce328112015-04-08 22:48:18 +000071 copy : {
Nils Diewaldaa17d142015-04-08 23:32:23 +000072 options: {
73 process:false
74 },
75 main: {
76 files:[
77 {
78 expand: true,
79 cwd: 'dev/font/',
80 src: '**',
81 dest: 'public/font/',
82 filter: 'isFile',
83 nonull: true,
84 timestamp: true
85 },
86 {
87 expand: true,
88 cwd: 'dev/img/',
89 src: 'favicon.ico',
90 dest: 'public/',
91 nonull:true,
92 timestamp:true
93 }
94 ]
95 }
Nils Diewaldce328112015-04-08 22:48:18 +000096 },
Nils Diewaldea236742015-03-26 21:55:36 +000097 watch: {
Nils Diewaldea236742015-03-26 21:55:36 +000098 css: {
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000099 files: ['dev/scss/{util,base,fonts,kalamar,media}.scss',
100 'dev/scss/footer/footer.scss',
Nils Diewalda1228622015-04-25 01:59:10 +0000101 'dev/scss/header/{header,hint,menu,searchbar,vc,datepicker}.scss',
Nils Diewald4c221252015-04-21 20:19:25 +0000102 'dev/scss/main/{alertify,highlight,kwic,logos,' +
103 'main,matchinfo,pagination,query,'+
104 'resultinfo,sidebar,tutorial}.scss'
Nils Diewaldab4d3ca2015-04-17 01:48:43 +0000105 ],
Nils Diewaldea236742015-03-26 21:55:36 +0000106 tasks: ['sass'],
107 options: {
108 spawn: false
109 }
110 }
Nils Diewald2488d052015-04-09 21:46:02 +0000111 }
Nils Diewaldea236742015-03-26 21:55:36 +0000112 });
113
Nils Diewaldea236742015-03-26 21:55:36 +0000114 grunt.loadNpmTasks('grunt-contrib-imagemin');
115 grunt.loadNpmTasks('grunt-contrib-watch');
116 grunt.loadNpmTasks('grunt-contrib-sass');
Nils Diewalda297f062015-04-02 00:23:46 +0000117 grunt.loadNpmTasks('grunt-contrib-jasmine');
Nils Diewaldce328112015-04-08 22:48:18 +0000118 grunt.loadNpmTasks('grunt-contrib-copy');
Nils Diewald0e6992a2015-04-14 20:13:52 +0000119 grunt.loadNpmTasks('grunt-contrib-requirejs');
120
121 grunt.registerTask('default', ['requirejs']);
Nils Diewalda31a5152015-04-17 21:05:23 +0000122 grunt.registerTask('img', ['imagemin','copy']);
Nils Diewaldea236742015-03-26 21:55:36 +0000123 grunt.registerTask('css', ['sass']);
Nils Diewaldce328112015-04-08 22:48:18 +0000124 grunt.registerTask(
125 'default',
Nils Diewald0e6992a2015-04-14 20:13:52 +0000126 ['copy', 'requirejs', 'imagemin', 'sass']
Nils Diewaldce328112015-04-08 22:48:18 +0000127 );
Nils Diewaldea236742015-03-26 21:55:36 +0000128};