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 | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame^] | 74 | copy : { |
| 75 | src: 'dev/font/**', |
| 76 | dest: 'public/font/', |
| 77 | nonull: true, |
| 78 | timestamp: true |
| 79 | }, |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 80 | watch: { |
| 81 | /* |
| 82 | options: { |
| 83 | livereload: true |
| 84 | }, |
| 85 | scripts: { |
| 86 | files: ['js/*.js'], |
| 87 | tasks: ['concat', 'uglify'], |
| 88 | options: { |
| 89 | spawn: false |
| 90 | }, |
| 91 | }, |
| 92 | */ |
| 93 | css: { |
Nils Diewald | a944fab | 2015-04-08 21:02:04 +0000 | [diff] [blame] | 94 | 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] | 95 | tasks: ['sass'], |
| 96 | options: { |
| 97 | spawn: false |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | }); |
| 102 | |
| 103 | grunt.loadNpmTasks('grunt-contrib-concat'); |
| 104 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
| 105 | grunt.loadNpmTasks('grunt-contrib-imagemin'); |
| 106 | grunt.loadNpmTasks('grunt-contrib-watch'); |
| 107 | grunt.loadNpmTasks('grunt-contrib-sass'); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 108 | grunt.loadNpmTasks('grunt-contrib-jasmine'); |
Nils Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame^] | 109 | grunt.loadNpmTasks('grunt-contrib-copy'); |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 110 | grunt.registerTask('css', ['sass']); |
Nils Diewald | ce32811 | 2015-04-08 22:48:18 +0000 | [diff] [blame^] | 111 | grunt.registerTask( |
| 112 | 'default', |
| 113 | ['copy', 'concat', 'uglify', 'imagemin', 'sass'] |
| 114 | ); |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame] | 115 | }; |