Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * http://gruntjs.com/getting-started |
| 3 | * |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 4 | * Todo: Move all source files outside the public folder! |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 5 | * |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 6 | * 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 Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 15 | module.exports = function(grunt) { |
| 16 | grunt.initConfig({ |
| 17 | pkg: grunt.file.readJSON('package.json'), |
| 18 | concat: { |
| 19 | dist: { |
| 20 | src : [ |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 21 | '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 Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 30 | ], |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 31 | dest: 'dev/js/build/kalamar.js' |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 32 | } |
| 33 | }, |
| 34 | uglify : { |
| 35 | build : { |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 36 | src: 'dev/js/build/kalamar.js', |
| 37 | dest: 'public/js/kalamar-<%= pkg.version %>.js' |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 38 | } |
| 39 | }, |
| 40 | imagemin: { |
| 41 | dynamic: { |
| 42 | files: [{ |
| 43 | expand: true, |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 44 | cwd: 'dev/img/', |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 45 | src: ['*.{png,gif,jpg,svg}'], |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 46 | dest: 'public/img/' |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 47 | }] |
| 48 | } |
| 49 | }, |
| 50 | sass: { |
| 51 | dist: { |
| 52 | options: { |
| 53 | style: 'compressed' |
| 54 | }, |
| 55 | files: { |
Nils Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame] | 56 | 'public/css/kalamar-<%= pkg.version %>.css' : 'dev/scss/kalamar.scss', |
| 57 | 'dev/css/kalamar.css' : 'dev/scss/kalamar.scss' |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | }, |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 61 | jasmine: { |
| 62 | pivotal: { |
| 63 | src: [ |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 64 | 'dev/js/src/menu.js', |
| 65 | 'dev/js/src/match.js', |
| 66 | 'dev/js/src/match.js', |
| 67 | 'dev/js/src/vc.js' |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 68 | ], |
| 69 | options: { |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 70 | specs: 'dev/js/spec/*Spec.js' |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 71 | } |
| 72 | } |
| 73 | }, |
Nils Diewald | aa17d14 | 2015-04-08 23:32:23 +0000 | [diff] [blame^] | 74 | // see https://github.com/gruntjs/grunt-contrib-copy/issues/64 |
Nils Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame] | 75 | copy : { |
Nils Diewald | aa17d14 | 2015-04-08 23:32:23 +0000 | [diff] [blame^] | 76 | 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 Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame] | 100 | }, |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 101 | 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 Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 115 | files: ['dev/scss/{util,fonts,base,header,searchbar,matchinfo,resultinfo,kwic,menu,hint,pagination,logos,alertify,vc,media,kalamar,tutorial,query,sidebar}.scss'], |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 116 | 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 Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 129 | grunt.loadNpmTasks('grunt-contrib-jasmine'); |
Nils Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame] | 130 | grunt.loadNpmTasks('grunt-contrib-copy'); |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 131 | grunt.registerTask('css', ['sass']); |
Nils Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame] | 132 | grunt.registerTask( |
| 133 | 'default', |
| 134 | ['copy', 'concat', 'uglify', 'imagemin', 'sass'] |
| 135 | ); |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 136 | }; |