This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
141 lines (122 loc) · 2.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* PERFORMANCE
*
* 1. For performance reasons you should only matching one level down, if possible.
* 2. Try to keep your watch task clean. Do NOT watch everything (like icons).
* 3. Add 'spawn: false' to your watch task when you need to speed up your build.
*
*/
module.exports = function( grunt ) {
'use strict';
// load only used tasks and add fallbacks for those which cannot be find
require( 'jit-grunt' )( grunt, {
'replace': 'grunt-text-replace'
} );
// measures the time each task takes
require( 'time-grunt' )( grunt );
var options = {
// Project settings
config: {
// in this directory you can find your grunt config tasks
src: 'configs/_grunt/*.js'
},
// define your path structure
paths: {
// helpers folder with grunt tasks and templates, tests and photobox
configs: 'configs',
// src folder with working files
src: 'src',
dist: 'dist',
vendor: 'src/vendor',
presentations: 'presentations'
},
// define your ports for grunt-contrib-connect
ports: {
app: process.env.PORT || 3000,
test: 3001,
livereload: 35731
}
};
// Load grunt configurations automatically
var configs = require( 'load-grunt-configs' )( grunt, options );
// Define the configuration for all the tasks
grunt.initConfig( configs );
/*
* SIMPLE TASKS
*/
grunt.registerMultiTask( 'clean', function() {
var options = this.options();
this.filesSrc.forEach( function( filepath ) {
grunt.log.writeln( 'DELETING ' + filepath );
grunt.file.delete( filepath, options );
} );
} );
// SASS Task
grunt.registerTask( 'watchCSS', [
'replace:revealResets',
'sass:dist'
] );
// Sprites Task
grunt.registerTask( 'icons', [
'dr-svg-sprites',
'replace:spriteUrl'
] );
// Sync JS Task
grunt.registerTask( 'syncJS', [
'sync:js'
] );
// Build HTML Task
grunt.registerTask( 'build-html', [
'assemble',
'htmlmin',
'copy'
] );
// HTML Hint Task (Check your HTML)
grunt.registerTask( 'check-html', [
'htmlhint'
] );
// JS Hint Task (Check you JS)
grunt.registerTask( 'check-js', [
'jshint'
] );
/*
* ADVANCED TASKS
*/
grunt.registerTask( 'server', [
'newer:assemble',
'copy',
'concurrent:syncing',
'watchCSS',
'connect:livereload',
'watch'
] );
grunt.registerTask( 'build', [
'clean:all',
'concurrent:syncing',
'watchCSS',
'combine_mq',
'cssmin',
'assemble',
'htmlmin',
'copy',
'concurrent:build'
] );
grunt.registerTask( 'build-prod', [
'clean:all',
'watchCSS',
'combine_mq',
'cssmin',
'assemble',
'htmlmin',
'copy',
'replace:socketUrl'
] );
grunt.registerTask( 'default', [
'build',
'server'
] );
// alias serve by grunt convention
grunt.registerTask( 'serve', [
'server'
] );
};