1
+ 'use strict' ;
2
+
3
+ module . exports = function ( grunt ) {
4
+
5
+ // Project configuration.
6
+ grunt . initConfig ( {
7
+ // Metadata.
8
+ pkg : grunt . file . readJSON ( 'storelocator.jquery.json' ) ,
9
+ banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
10
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
11
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
12
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
13
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n' ,
14
+ // Task configuration.
15
+ clean : {
16
+ files : [ 'dist' ]
17
+ } ,
18
+ less : {
19
+ dist : {
20
+ src : 'src/css/storelocator.less' ,
21
+ dest : 'dist/css/storelocator.css'
22
+ } ,
23
+ } ,
24
+ concat : {
25
+ options : {
26
+ stripBanners : true
27
+ } ,
28
+ dist : {
29
+ src : [ 'src/js/jquery.<%= pkg.name %>.js' ] ,
30
+ dest : 'dist/js/jquery.<%= pkg.name %>.js'
31
+ } ,
32
+ } ,
33
+ uglify : {
34
+ dist : {
35
+ files : {
36
+ 'dist/js/jquery.<%= pkg.name %>.min.js' : '<%= concat.dist.dest %>' ,
37
+ 'dist/js/handlebars.min.js' : 'libs/handlebars/*.js'
38
+ }
39
+ } ,
40
+ } ,
41
+ qunit : {
42
+ files : [ 'test/**/*.html' ]
43
+ } ,
44
+ jshint : {
45
+ gruntfile : {
46
+ options : {
47
+ jshintrc : '.jshintrc'
48
+ } ,
49
+ src : 'Gruntfile.js'
50
+ } ,
51
+ src : {
52
+ options : {
53
+ jshintrc : 'src/.jshintrc'
54
+ } ,
55
+ src : [ 'src/**/*.js' ]
56
+ } ,
57
+ test : {
58
+ options : {
59
+ jshintrc : 'test/.jshintrc'
60
+ } ,
61
+ src : [ 'test/**/*.js' ]
62
+ } ,
63
+ } ,
64
+ usebanner : {
65
+ dist : {
66
+ options : {
67
+ position : 'top' ,
68
+ banner : '<%= banner %>'
69
+ } ,
70
+ files : {
71
+ 'dist/js/jquery.<%= pkg.name %>.js' : 'dist/js/jquery.<%= pkg.name %>.js' ,
72
+ 'dist/js/jquery.<%= pkg.name %>.min.js' : 'dist/js/jquery.<%= pkg.name %>.min.js'
73
+ }
74
+ } ,
75
+ } ,
76
+ cssmin : {
77
+ dist : {
78
+ files : {
79
+ 'dist/css/storelocator.min.css' : 'dist/css/storelocator.css'
80
+ }
81
+ } ,
82
+ } ,
83
+ watch : {
84
+ gruntfile : {
85
+ files : '<%= jshint.gruntfile.src %>' ,
86
+ tasks : [ 'jshint:gruntfile' ]
87
+ } ,
88
+ src : {
89
+ files : [ 'src/**/*' ] ,
90
+ tasks : [ 'less' , 'concat' , 'uglify' , 'usebanner' , 'cssmin' ]
91
+ } ,
92
+ test : {
93
+ files : '<%= jshint.test.src %>' ,
94
+ tasks : [ 'jshint:test' , 'qunit' ]
95
+ } ,
96
+ } ,
97
+ } ) ;
98
+
99
+ // These plugins provide necessary tasks.
100
+ grunt . loadNpmTasks ( 'grunt-contrib-clean' ) ;
101
+ grunt . loadNpmTasks ( 'grunt-contrib-less' ) ;
102
+ grunt . loadNpmTasks ( 'grunt-contrib-concat' ) ;
103
+ grunt . loadNpmTasks ( 'grunt-contrib-uglify' ) ;
104
+ grunt . loadNpmTasks ( 'grunt-contrib-qunit' ) ;
105
+ grunt . loadNpmTasks ( 'grunt-contrib-jshint' ) ;
106
+ grunt . loadNpmTasks ( 'grunt-contrib-watch' ) ;
107
+ grunt . loadNpmTasks ( 'grunt-banner' ) ;
108
+ grunt . loadNpmTasks ( 'grunt-contrib-cssmin' ) ;
109
+
110
+ // Default task.
111
+ grunt . registerTask ( 'default' , [ 'jshint' , 'qunit' , 'less' , 'concat' , 'uglify' , 'usebanner' , 'cssmin' ] ) ;
112
+ // Build
113
+ grunt . registerTask ( 'build' , [ 'less' , 'concat' , 'uglify' , 'usebanner' , 'cssmin' ] ) ;
114
+ //Watch src build
115
+ grunt . registerTask ( 'watchsrc' , [ 'watch:src' ] ) ;
116
+
117
+ } ;
0 commit comments