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