|
| 1 | +module.exports = (grunt) -> |
| 2 | + require('load-grunt-tasks') grunt |
| 3 | + grunt.file.readJSON('package.json') |
| 4 | + |
| 5 | + License = '/*!Copyright(c) CommentCoreLibrary (//github.com/jabbany/CommentCoreLibrary) - Licensed under the MIT License */' |
| 6 | + |
| 7 | + SRC_CORE = [ |
| 8 | + 'src/CommentFilter.js' |
| 9 | + 'src/CommentSpaceAllocator.js' |
| 10 | + 'src/CommentCoreLibrary.js' |
| 11 | + ] |
| 12 | + |
| 13 | + SRC_TRANSITION = [ |
| 14 | + 'src/CCLComment.js' |
| 15 | + 'src/CommentFilter.js' |
| 16 | + 'src/CommentTransitionSpaceAllocator.js' |
| 17 | + 'src/CommentTransitionLibrary.js' |
| 18 | + ] |
| 19 | + |
| 20 | + SRC_PARSER = [ |
| 21 | + 'src/parsers/AcfunFormat.js' |
| 22 | + 'src/parsers/BilibiliFormat.js' |
| 23 | + ] |
| 24 | + |
| 25 | + SRC_CORELIB = SRC_PARSER.concat(SRC_CORE) |
| 26 | + |
| 27 | + grunt.initConfig( |
| 28 | + # Concat CSS and JS files |
| 29 | + concat: |
| 30 | + basic_and_extras: |
| 31 | + files: |
| 32 | + 'build/style.css': ['src/base.css', 'src/fontalias.css'] |
| 33 | + 'build/CommentCore.js': SRC_CORE |
| 34 | + 'build/CommentCoreLibrary.js': SRC_CORELIB |
| 35 | + |
| 36 | + # Auto-prefix CSS properties using Can I Use? |
| 37 | + autoprefixer: |
| 38 | + options: |
| 39 | + browsers: ['last 3 versions', 'bb 10', 'android 3'] |
| 40 | + |
| 41 | + no_dest: |
| 42 | + # File to output |
| 43 | + src: 'build/style.css' |
| 44 | + |
| 45 | + # Minify CSS |
| 46 | + cssmin: |
| 47 | + minify: |
| 48 | + src: ['build/style.css'] |
| 49 | + dest: 'build/style.min.css' |
| 50 | + |
| 51 | + uglify: |
| 52 | + options: banner: License |
| 53 | + comment_core: |
| 54 | + files: |
| 55 | + 'build/CommentCore.min.js': SRC_CORE |
| 56 | + comment_core_lib: |
| 57 | + files: |
| 58 | + 'build/CommentCoreLibrary.min.js': SRC_CORELIB |
| 59 | + |
| 60 | + # Watch files for changes |
| 61 | + watch: |
| 62 | + css: |
| 63 | + files: ['src/**/*', '!node_modules'] |
| 64 | + |
| 65 | + # Run concat, autoprefixer, cssmin and uglify |
| 66 | + tasks: ['build'] |
| 67 | + ) |
| 68 | + |
| 69 | + # Register our tasks |
| 70 | + grunt.registerTask 'build', ['concat', 'autoprefixer', 'cssmin', 'uglify'] |
| 71 | + grunt.registerTask 'default', ['build', 'watch'] |
| 72 | + |
0 commit comments