@@ -2,23 +2,41 @@ module.exports = function (grunt) {
22
33 grunt . loadNpmTasks ( 'grunt-karma' ) ;
44 grunt . loadNpmTasks ( 'grunt-contrib-jshint' ) ;
5+ grunt . loadNpmTasks ( 'grunt-contrib-uglify' ) ;
6+ grunt . loadNpmTasks ( 'grunt-contrib-copy' ) ;
57
68 // Default task.
79 grunt . registerTask ( 'default' , [ 'jshint' , 'karma' ] ) ;
10+ grunt . registerTask ( 'build-doc' , [ 'uglify' , 'copy' ] ) ;
811
912 var testConfig = function ( configFile , customOptions ) {
10- var options = { configFile : configFile } ;
13+ var options = { configFile : configFile , keepalive : false } ;
1114 var travisOptions = process . env . TRAVIS && { browsers : [ 'Firefox' ] , reporters : [ 'dots' ] } ;
1215 return grunt . util . _ . extend ( options , customOptions , travisOptions ) ;
1316 } ;
1417
1518 // Project configuration.
1619 grunt . initConfig ( {
20+ pkg : grunt . file . readJSON ( 'package.json' ) ,
21+ meta : {
22+ banner : [ '/**' ,
23+ ' * <%= pkg.name %> - <%= pkg.description %>' ,
24+ ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>' ,
25+ ' * @link <%= pkg.homepage %>' ,
26+ ' * @license <%= pkg.license %>' ,
27+ ' */' ,
28+ '' ] . join ( '\n' ) ,
29+ destName : 'out/build/<%= pkg.name %>' ,
30+ view : {
31+ humaName : "UI Map" ,
32+ repoName : "ui-map"
33+ }
34+ } ,
1735 karma : {
1836 unit : testConfig ( 'test/karma.conf.js' )
1937 } ,
2038 jshint :{
21- all :[ 'ui-codemirror. js' , 'gruntFile.js' , 'test/**/*.js' ] ,
39+ files :[ '<%= pkg.name %>. js' , 'gruntFile.js' , 'test/**/*Spec.js' , 'demo /**/*.js'] ,
2240 options :{
2341 curly :true ,
2442 eqeqeq :true ,
@@ -31,6 +49,29 @@ module.exports = function (grunt) {
3149 eqnull :true ,
3250 globals :{ }
3351 }
52+ } ,
53+ uglify : {
54+ options : { banner : '<%= meta.banner %>' } ,
55+ build : {
56+ files : {
57+ '<%= meta.destName %>.min.js' : [ '<%= pkg.name %>.js' ]
58+ }
59+ }
60+ } ,
61+ copy : {
62+ main : {
63+ files : [
64+ { src : [ 'demo/demo.html' ] , dest : 'out/demos.html' , filter : 'isFile' }
65+ ]
66+ } ,
67+ template : {
68+ options : { processContent : function ( content ) {
69+ return grunt . template . process ( content ) ;
70+ } } ,
71+ files : [
72+ { src : [ 'out/.tmpl/index.tmpl' ] , dest : 'out/index.html' }
73+ ]
74+ }
3475 }
3576 } ) ;
3677
0 commit comments