-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGruntfile.js
executable file
·114 lines (91 loc) · 2.5 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
module.exports = function( grunt ) {
var mode = grunt.option( 'mode' ) || 'dev';
// load tasks
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
if ( mode == 'prod' ) {
grunt.log.subhead( 'Running Grunt in `Production` mode' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
} else {
grunt.log.subhead( 'Running Grunt in `Development` mode' );
}
grunt.initConfig({
// compass dev does expanded else compressed
compass: {
dist: {
options: {
config: 'config.rb',
outputStyle: ( mode == 'dev' ) ? 'expanded' : 'compressed',
force: true
}
}
},
//minify main.js
uglify: {
dist: {
files: {
'assets/js/main.js': [ 'assets/js/main.js' ]
}
},
},
// concatenation
concat: {
options: {
separator: '\n'
},
dist: {
src: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/gsap/src/minified/TimelineMax.min.js',
'bower_components/gsap/src/minified/TweenMax.min.js',
'bower_components/jquery.transit/jquery.transit.js',
'bower_components/gsap/src/minified/jquery.gasp.min.js',
'bower_components/stickyjs/stickyjs.js',
'bower_components/ScrollMagic/js/jquery.scrollmagic.js',
'assets/js/src/plugins/*.js',
'assets/js/src/core/Global.js',
'assets/js/src/classes/*.js',
'assets/js/src/main.dev.js'
],
dest: 'assets/js/main.js'
}
},
// watch our project for changes
watch: {
compass: {
files: [
'assets/sass/*.scss',
'assets/sass/**/*.scss'
],
tasks: [ 'compass' ]
},
js: {
files: [
'assets/js/src/plugins/*.js',
'assets/js/src/classes/*.js',
'assets/js/src/main.dev.js'
],
tasks: ['concat']
}
},
});
// register task default task
grunt.registerTask( 'default', function() {
// some tasks we only want to run in production mode
if ( mode == 'prod' ) {
grunt.task.run([
'compass',
'concat',
'uglify'
]);
} else {
grunt.task.run([
'compass',
'concat',
'watch'
]);
}
});
};