Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame^] | 1 | /** |
| 2 | */ |
| 3 | /* |
| 4 | * http://gruntjs.com/getting-started |
| 5 | * |
| 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 | */ |
| 15 | |
| 16 | module.exports = function(grunt) { |
| 17 | grunt.initConfig({ |
| 18 | pkg: grunt.file.readJSON('package.json'), |
| 19 | concat: { |
| 20 | dist: { |
| 21 | src : [ |
| 22 | 'js/lib/dagre/dagre.min.js', |
| 23 | 'js/src/menu.js', |
| 24 | 'js/src/matchInfo.js', |
| 25 | 'js/src/hint.js', |
| 26 | 'js/src/vc.js' |
| 27 | ], |
| 28 | dest: 'js/build/kalamar.js' |
| 29 | } |
| 30 | }, |
| 31 | uglify : { |
| 32 | build : { |
| 33 | src: 'js/build/kalamar.js', |
| 34 | dest: 'js/build/kalamar.min.js' |
| 35 | } |
| 36 | }, |
| 37 | imagemin: { |
| 38 | dynamic: { |
| 39 | files: [{ |
| 40 | expand: true, |
| 41 | cwd: 'img/', |
| 42 | src: ['**/*.{png,gif,jpg,svg}'], |
| 43 | dest: 'img/build/' |
| 44 | }] |
| 45 | } |
| 46 | }, |
| 47 | sass: { |
| 48 | dist: { |
| 49 | options: { |
| 50 | style: 'compressed' |
| 51 | }, |
| 52 | files: { |
| 53 | 'css/build/kalamar.css': 'scss/kalamar.scss' |
| 54 | } |
| 55 | } |
| 56 | }, |
| 57 | watch: { |
| 58 | /* |
| 59 | options: { |
| 60 | livereload: true |
| 61 | }, |
| 62 | scripts: { |
| 63 | files: ['js/*.js'], |
| 64 | tasks: ['concat', 'uglify'], |
| 65 | options: { |
| 66 | spawn: false |
| 67 | }, |
| 68 | }, |
| 69 | */ |
| 70 | css: { |
| 71 | files: ['scss/{colors,base,matchinfo,menu,pagination,kalamar}.scss'], |
| 72 | tasks: ['sass'], |
| 73 | options: { |
| 74 | spawn: false |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | }); |
| 79 | |
| 80 | grunt.loadNpmTasks('grunt-contrib-concat'); |
| 81 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
| 82 | grunt.loadNpmTasks('grunt-contrib-imagemin'); |
| 83 | grunt.loadNpmTasks('grunt-contrib-watch'); |
| 84 | grunt.loadNpmTasks('grunt-contrib-sass'); |
| 85 | grunt.registerTask('css', ['sass']); |
| 86 | grunt.registerTask('default', ['concat', 'uglify', 'imagemin', 'sass']); |
| 87 | }; |