-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
101 lines (92 loc) · 2.25 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
module.exports = function(grunt) {
var baseDir = './src/assets/'
var bowerDir = "bower_components/";
var nodeDir = 'node_modules/';
var destDir = './site/'
var common = [
bowerDir + 'jquery/dist/jquery.js',
bowerDir + 'magnific-popup/dist/jquery.magnific-popup.js',
baseDir + 'js/common.js'
];
grunt.initConfig({
compass: {
dist: {
options: {
sassDir: baseDir + 'scss',
cssDir: baseDir + 'css',
environment: 'production'
}
},
dev: {
options: {
sassDir: baseDir + 'scss',
cssDir: baseDir + 'css'
}
}
},
uglify: {
options: {
mangle: false
},
my_target: {
files: {
[destDir + 'js/index.min.js']: common.concat([baseDir + 'js/index.js']),
[destDir + 'js/about.min.js']: common.concat([baseDir + 'js/about.js']),
[destDir + 'js/what.min.js']: common.concat([baseDir + 'js/what.js']),
[destDir + 'js/product.min.js']: common.concat([
bowerDir + 'jquery-validation/dist/jquery.validate.min.js',
baseDir + 'js/product.js'
]),
[destDir + 'js/fabrics.min.js']: [
nodeDir + 'jquery-zoom/jquery.zoom.js'
].concat([baseDir + 'js/fabrics.js']),
[destDir + 'js/work.min.js']: common.concat([baseDir + 'js/work.js']),
[destDir + 'js/contact.min.js']: common.concat(
[ bowerDir + 'jquery-validation/dist/jquery.validate.min.js',
baseDir + 'js/contact.js'
]),
}
}
},
webfont: {
icons: {
options: {
execMaxBuffer: 1024 * 1024,
stylesheet: 'scss',
relativeFontPath: '../fonts'
},
src: baseDir + 'svg/*.svg',
dest: baseDir + 'fonts',
destCss: baseDir + 'scss/'
}
},
watch: {
css: {
files: [baseDir + 'scss/**/*.scss'],
tasks: ['compass'],
options: {
spawn: false,
},
},
js: {
files: [baseDir + 'js/**/*.js'],
tasks: ['uglify'],
options: {
spawn: false,
},
},
webfont: {
files: [baseDir + 'svg/**/*.svg'],
tasks: ['webfont'],
options: {
spawn: false,
},
},
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-webfont');
grunt.registerTask('default', ['compass', 'uglify', 'webfont', 'watch']);
}