forked from djanix/jquery.switcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
93 lines (89 loc) · 1.88 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
module.exports = function (grunt) {
require('matchdep').filterDev('grunt-*').forEach(
grunt.loadNpmTasks
);
var config = {
destFolder: 'dist',
banner: '/* <%= pkg.name %> - <%= pkg.version %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy-mm-dd") %> <%= pkg.author.name %> - <%= pkg.author.url %> */\n\n'
};
grunt.initConfig({
config: config,
pkg: grunt.file.readJSON('package.json'),
banner: '<%= config.banner %>',
autoprefixer: {
single_file: {
options: {
browsers: ['last 3 version', '> 1%', 'ie 8']
},
src: '<%= config.destFolder %>/*.css'
}
},
copy: {
main: {
src: 'switcher.js',
dest: '<%= config.destFolder %>/switcher.js'
}
},
jshint: {
files: ['switcher.js'],
options: {
force: true
}
},
sass: {
dist: {
options: {
style: 'expanded',
banner: '<%= config.banner %>'
},
files: [
{
src: 'switcher.scss',
dest: '<%= config.destFolder %>/switcher.css'
}
]
},
minified: {
options: {
style: 'compressed',
banner: '<%= config.banner %>'
},
files: [
{
src: 'switcher.scss',
dest: '<%= config.destFolder %>/switcher.min.css'
}
]
}
},
uglify: {
dist: {
options: {
banner: '<%= config.banner %>'
},
files: {
'<%= config.destFolder %>/switcher.min.js': ['switcher.js']
}
}
},
watch: {
js: {
files: ['switcher.js'],
tasks: ['build:js']
},
sass: {
files: ["switcher.scss"],
tasks: ['build:css']
},
options: {
spawn: true
}
}
});
grunt.registerTask('default', ['build:js', 'build:css', 'watch']);
grunt.registerTask('build', ['build:js', 'build:css']);
grunt.registerTask('build:css', ['sass', 'autoprefixer']);
grunt.registerTask('build:js', ['jshint', 'copy', 'uglify']);
};