Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 1 | /** |
| 2 | */ |
| 3 | /* |
| 4 | * http://gruntjs.com/getting-started |
| 5 | * |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 6 | * Todo: Move all source files outside the public folder! |
| 7 | |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 8 | * TODO: Use https://www.npmjs.com/package/grunt-contrib-compress |
| 9 | * for assets. |
| 10 | * http://yui.github.io/yuidoc/ |
| 11 | * use it with https://www.npmjs.com/package/grunt-contrib-yuidoc |
| 12 | * |
| 13 | * RequireJS |
| 14 | * http://addyosmani.com/writing-modular-js/ |
| 15 | * http://qnundrum.com/question/393866 |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 16 | * |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | module.exports = function(grunt) { |
| 20 | grunt.initConfig({ |
| 21 | pkg: grunt.file.readJSON('package.json'), |
| 22 | concat: { |
| 23 | dist: { |
| 24 | src : [ |
| 25 | 'js/lib/dagre/dagre.min.js', |
| 26 | 'js/src/menu.js', |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 27 | 'js/src/match.js', |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 28 | 'js/src/hint.js', |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 29 | 'js/src/vc.js', |
| 30 | 'js/src/api.js', |
| 31 | 'js/src/session.js', |
| 32 | 'js/src/tutorial.js', |
| 33 | 'js/src/util.js' |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 34 | ], |
| 35 | dest: 'js/build/kalamar.js' |
| 36 | } |
| 37 | }, |
| 38 | uglify : { |
| 39 | build : { |
| 40 | src: 'js/build/kalamar.js', |
| 41 | dest: 'js/build/kalamar.min.js' |
| 42 | } |
| 43 | }, |
| 44 | imagemin: { |
| 45 | dynamic: { |
| 46 | files: [{ |
| 47 | expand: true, |
| 48 | cwd: 'img/', |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 49 | src: ['*.{png,gif,jpg,svg}'], |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 50 | dest: 'img/build/' |
| 51 | }] |
| 52 | } |
| 53 | }, |
| 54 | sass: { |
| 55 | dist: { |
| 56 | options: { |
| 57 | style: 'compressed' |
| 58 | }, |
| 59 | files: { |
| 60 | 'css/build/kalamar.css': 'scss/kalamar.scss' |
| 61 | } |
| 62 | } |
| 63 | }, |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 64 | jasmine: { |
| 65 | pivotal: { |
| 66 | src: [ |
| 67 | 'js/src/menu.js', |
| 68 | 'js/src/match.js', |
| 69 | 'js/src/match.js', |
| 70 | 'js/src/vc.js' |
| 71 | ], |
| 72 | options: { |
| 73 | specs: 'js/spec/*Spec.js' |
| 74 | } |
| 75 | } |
| 76 | }, |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 77 | watch: { |
| 78 | /* |
| 79 | options: { |
| 80 | livereload: true |
| 81 | }, |
| 82 | scripts: { |
| 83 | files: ['js/*.js'], |
| 84 | tasks: ['concat', 'uglify'], |
| 85 | options: { |
| 86 | spawn: false |
| 87 | }, |
| 88 | }, |
| 89 | */ |
| 90 | css: { |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 91 | files: ['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] | 92 | tasks: ['sass'], |
| 93 | options: { |
| 94 | spawn: false |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | }); |
| 99 | |
| 100 | grunt.loadNpmTasks('grunt-contrib-concat'); |
| 101 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
| 102 | grunt.loadNpmTasks('grunt-contrib-imagemin'); |
| 103 | grunt.loadNpmTasks('grunt-contrib-watch'); |
| 104 | grunt.loadNpmTasks('grunt-contrib-sass'); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 105 | grunt.loadNpmTasks('grunt-contrib-jasmine'); |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 106 | grunt.registerTask('css', ['sass']); |
| 107 | grunt.registerTask('default', ['concat', 'uglify', 'imagemin', 'sass']); |
| 108 | }; |