comparison iframe-resizer/gruntfile.js @ 0:ac5f9272033b draft

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