forked from t413/SinglePaged
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
100 lines (89 loc) · 1.78 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
module.exports = function(grunt) {
// Config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
reporter: require('jshint-stylish')
},
dist: {
files: {
src: ['ideal-image-slider.js']
}
},
extensions: {
files: {
src: ['extensions/**/*.js']
}
}
},
uglify: {
options: {
banner: '/*! Ideal Image Slider v<%= pkg.version %> */\n'
},
dist: {
files: {
'ideal-image-slider.min.js': 'ideal-image-slider.js'
}
}
},
'string-replace': {
version: {
options: {
replacements: [{
pattern: /(v\d+.\d+.\d+)/,
replacement: 'v<%= pkg.version %>'
}]
},
files: {
'ideal-image-slider.js': 'ideal-image-slider.js',
'ideal-image-slider.css': 'ideal-image-slider.css'
}
}
},
qunit: {
all: ['tests/**/*.html']
},
watch: {
options: {
livereload: true
},
dist: {
files: ['ideal-image-slider.js'],
tasks: ['jshint:dist','uglify','string-replace'],
options: {
spawn: false,
}
},
extensions: {
files: ['extensions/**/*.js'],
tasks: ['jshint:extensions'],
options: {
spawn: false,
}
}
}
});
// Plugins
require('load-grunt-tasks')(grunt);
grunt.registerTask('forceOn', 'turns the --force option ON', function(){
if ( !grunt.option( 'force' ) ) {
grunt.config.set('forceStatus', true);
grunt.option( 'force', true );
}
});
grunt.registerTask('forceOff', 'turns the --force option OFF', function(){
if ( grunt.config.get('forceStatus') ) {
grunt.config.set('forceStatus', false);
grunt.option( 'force', false );
}
});
// Tasks
grunt.registerTask('default', [
'jshint',
'uglify',
'string-replace',
'watch'
]);
grunt.registerTask('test', ['qunit']);
};