forked from bigskysoftware/intercooler-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
47 lines (42 loc) · 1.6 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/intercooler.js',
dest: 'www/release/intercooler-<%= pkg.version %>.min.js'
}
},
"regex-replace": {
"update-test-ref": { //specify a target with any name
src: ['www/release/unit-tests-<%= pkg.version %>.html'],
actions: [
{
name: 'lib ref',
search: "../src/intercooler.js",
replace: './intercooler-<%= pkg.version %>.js',
flags: 'g'
}
]
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-regex-replace');
grunt.registerTask('release', "Releases a new version of the library", function () {
grunt.file.copy("src/intercooler.js", 'www/release/intercooler-' + grunt.config.get('pkg').version + '.js');
grunt.file.copy("src/intercooler-debugger.js", 'www/release/intercooler-debugger.js');
grunt.file.copy("test/blanket.min.js", 'www/release/blanket.min.js');
grunt.file.copy("test/jquery.mockjax.js", 'www/release/jquery.mockjax.js');
grunt.file.copy("test/unit_tests.html", 'www/release/unit-tests-' + grunt.config.get('pkg').version + '.html');
grunt.task.run('uglify');
grunt.task.run('regex-replace');
});
// Default task(s).
grunt.registerTask('default', ['release']);
};