forked from davidjbradshaw/iframe-resizer
/
gruntfile.js
151 lines (132 loc) · 4.04 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*global module:false*/
module.exports = function(grunt) {
'Use strict';
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
//require('load-grunt-tasks')(grunt);
require('jit-grunt')(grunt,{
'bump-only':'grunt-bump',
'bump-commit':'grunt-bump'
});
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
bannerLocal: '/*! iFrame Resizer (iframeSizer.min.js ) - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * Desc: Force cross domain iframes to size to content.\n' +
' * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.\n' +
' * Copyright: (c) <%= grunt.template.today("yyyy") %> David J. Bradshaw - dave@bradshaw.net\n' +
' * License: MIT\n */\n',
bannerRemote: '/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * Desc: Include this file in any page being loaded into an iframe\n' +
' * to force the iframe to resize to the content size.\n' +
' * Requires: iframeResizer.min.js on host page.\n' +
' * Copyright: (c) <%= grunt.template.today("yyyy") %> David J. Bradshaw - dave@bradshaw.net\n' +
' * License: MIT\n */\n'
},
qunit: {
files: ['test/*.html']
},
jshint: {
options: {
globals: {
jQuery:false,
require:true,
process:true
},
},
gruntfile: {
src: 'gruntfile.js'
},
code: {
src: 'src/**/*.js'
},
},
uglify: {
options: {
sourceMap:true,
sourceMapIncludeSources:true,
report:'gzip',
},
local: {
options:{
banner:'<%= meta.bannerLocal %>',
sourceMapName: 'js/iframeResizer.map'
},
src: ['src/iframeResizer.js'],
dest: 'js/iframeResizer.min.js',
},
remote: {
options: {
banner:'<%= meta.bannerRemote %>',
sourceMapName: 'js/iframeResizer.contentWindow.map'
},
src: ['src/iframeResizer.contentWindow.js'],
dest: 'js/iframeResizer.contentWindow.min.js',
},
polyfil: {
options: {
banner:'// IE8 polyfils for iframeResizer.js\n',
sourceMapName: 'js/ie8.polyfils.map'
},
src: ['src/ie8.polyfils.js'],
dest: 'js/ie8.polyfils.min.js',
}
},
watch: {
files: ['src/**/*'],
tasks: 'default'
},
bump: {
options: {
files: ['package.json','bower.json','iframeResizer.jquery.json'],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'], // '-a' for all files
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
}
},
shell: {
options:{
stdout: true,
stderr: true,
failOnError: true
},
npm:{
command: 'npm publish'
},
deployExample: {
command: function(){
var
retStr = '',
fs = require('fs');
if (fs.existsSync('bin')) {
retStr = 'bin/deploy.sh';
}
return retStr;
}
}
},
jsonlint: {
json: {
src: [ '*.json' ]
}
}
});
grunt.registerTask('default', ['notest','qunit']);
grunt.registerTask('notest', ['jsonlint','jshint','uglify']);
grunt.registerTask('test', ['jshint','qunit']);
grunt.registerTask('postBump',['uglify','bump-commit','shell']);
grunt.registerTask('patch', ['default','bump-only:patch','postBump']);
grunt.registerTask('minor', ['default','bump-only:minor','postBump']);
grunt.registerTask('major', ['default','bump-only:major','postBump']);
};