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', |
| 29 | 'js/src/vc.js' |
| 30 | ], |
| 31 | dest: 'js/build/kalamar.js' |
| 32 | } |
| 33 | }, |
| 34 | uglify : { |
| 35 | build : { |
| 36 | src: 'js/build/kalamar.js', |
| 37 | dest: 'js/build/kalamar.min.js' |
| 38 | } |
| 39 | }, |
| 40 | imagemin: { |
| 41 | dynamic: { |
| 42 | files: [{ |
| 43 | expand: true, |
| 44 | cwd: 'img/', |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame^] | 45 | src: ['*.{png,gif,jpg,svg}'], |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 46 | dest: 'img/build/' |
| 47 | }] |
| 48 | } |
| 49 | }, |
| 50 | sass: { |
| 51 | dist: { |
| 52 | options: { |
| 53 | style: 'compressed' |
| 54 | }, |
| 55 | files: { |
| 56 | 'css/build/kalamar.css': 'scss/kalamar.scss' |
| 57 | } |
| 58 | } |
| 59 | }, |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame^] | 60 | jasmine: { |
| 61 | pivotal: { |
| 62 | src: [ |
| 63 | 'js/src/menu.js', |
| 64 | 'js/src/match.js', |
| 65 | 'js/src/match.js', |
| 66 | 'js/src/vc.js' |
| 67 | ], |
| 68 | options: { |
| 69 | specs: 'js/spec/*Spec.js' |
| 70 | } |
| 71 | } |
| 72 | }, |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 73 | watch: { |
| 74 | /* |
| 75 | options: { |
| 76 | livereload: true |
| 77 | }, |
| 78 | scripts: { |
| 79 | files: ['js/*.js'], |
| 80 | tasks: ['concat', 'uglify'], |
| 81 | options: { |
| 82 | spawn: false |
| 83 | }, |
| 84 | }, |
| 85 | */ |
| 86 | css: { |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame^] | 87 | files: ['scss/{util,fonts,base,header,searchbar,matchinfo,resultinfo,kwic,menu,pagination,logos,alertify,kalamar}.scss'], |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 88 | tasks: ['sass'], |
| 89 | options: { |
| 90 | spawn: false |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | }); |
| 95 | |
| 96 | grunt.loadNpmTasks('grunt-contrib-concat'); |
| 97 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
| 98 | grunt.loadNpmTasks('grunt-contrib-imagemin'); |
| 99 | grunt.loadNpmTasks('grunt-contrib-watch'); |
| 100 | grunt.loadNpmTasks('grunt-contrib-sass'); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame^] | 101 | grunt.loadNpmTasks('grunt-contrib-jasmine'); |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 102 | grunt.registerTask('css', ['sass']); |
| 103 | grunt.registerTask('default', ['concat', 'uglify', 'imagemin', 'sass']); |
| 104 | }; |