-
Notifications
You must be signed in to change notification settings - Fork 933
/
Gruntfile.js
137 lines (130 loc) · 4.51 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
module.exports = function(grunt){
// Loading i18n task
require('./scripts/tasks/i18n')(grunt);
// -- Init Configuration ---------------------------------------
grunt.initConfig({
application:{
dev: {
csspath:"/assets/css/",
jspath:"/assets/js/",
imgpath:"/assets/img/",
},
dist:{
csspath:"/assets/css/",
jspath:"/assets/js/",
imgpath:"/assets/img/",
}
},
uglify:{
options: {
compress: false,
report: true,
banner: '/* Minified on <%= grunt.template.date() %>*/\n'
},
dev: {
files: {
'.tmp/public/assets/js/core.min.js': [
'public/assets/js/vendor/jquery.scrollstop.js',
'public/assets/js/vendor/jquery.lazyload.js',
'public/assets/js/core.js'
]
}
},
dist: {
files: {
'dist/public/assets/js/core.min.js': [
'public/assets/js/vendor/jquery.scrollstop.js',
'public/assets/js/vendor/jquery.lazyload.js',
'public/assets/js/core.js'
]
}
}
},
cssmin: {
options: {
banner: '/* Minified on <%= grunt.template.date() %>*/\n'
},
dev: {
files: {
'.tmp/public/assets/css/core.min.css': [
'public/assets/css/normalize.css',
'public/assets/css/core.css'
]
}
},
dist: {
files: {
'dist/public/assets/css/core.min.css': [
'public/assets/css/normalize.css',
'public/assets/css/core.css'
]
}
}
},
copy: {
dist: {
files: [
// includes files within path and its sub-directories
{expand: true, src: ['public/**', '!**/*[.css|.js]'], dest: 'dist/'}
],
},
dev: {
files: [
// includes files within path and its sub-directories
{expand: true, src: ['public/**', '!**/*[.css|.js]'], dest: '.tmp/'}
],
},
},
clean: {
dev: [".tmp/"],
dist: ["dist/"]
},
connect: {
dev: {
options: {
port: 9001,
base: ['.tmp/public']
}
},
dist: {
options: {
port: 9002,
base: ['dist/public/'],
keepalive:true
}
}
},
watch: {
assets: {
files: ['public/assets/css/*.css', 'public/assets/js/*.js', 'templates/**/*.html', 'i18n/**/*.json', 'i18n/**/*.html'],
tasks:['build'],
options: {
livereload: true
}
}
},
imagemin: { // Task
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'public/assets/img', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'dist/public/assets/img' // Destination path prefix
}]
}
}
});
// -- Load Plugins ----------------------------------------------
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-clean');
// -- Register Task ---------------------------------------------
grunt.registerTask('server', ['clean:dev' ,'i18n', 'copy:dev','cssmin:dev', 'uglify:dev','connect:dev', 'watch']);
grunt.registerTask('dist', ['clean:dist', 'i18n', 'copy:dist', 'cssmin:dist', 'uglify:dist', 'imagemin']);
grunt.registerTask('build', ['clean:dev', 'i18n', 'copy:dev', 'cssmin:dev', 'uglify:dev']);
grunt.registerTask('serverdist', ['connect:dist']);
};