-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
66 lines (63 loc) · 1.73 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
const output_dir = 'AM_Nihoul_website/static/';
const input_dir = 'AM_Nihoul_website/assets/';
const tasks = [
'grunt-contrib-jshint',
'grunt-contrib-less',
'grunt-contrib-uglify',
'grunt-contrib-watch',
'grunt-image'
];
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
files: ['Gruntfile.js', `${input_dir}/*.js`],
options: {
jshintrc: true,
}
},
less: {
build: {
options: {
compress: true
},
cwd: input_dir,
src: [`*.less`],
expand: true,
dest: output_dir,
ext: '.css'
}
},
uglify: {
build_editor: {
src: `${input_dir}/editor.js`,
dest: `${output_dir}/editor.min.js`
},
build_other: {
src: `${input_dir}/html-fix.js`,
dest: `${output_dir}/scripts.min.js`
}
},
image: {
build: {
files: [{
expand: true,
cwd: `${input_dir}/images`,
src: ['*.{png,svg,jpg}'],
dest: `${output_dir}/images`
}]
}
},
watch: {
js: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'uglify']
},
css: {
files: [`${input_dir}/style.less`],
tasks: ['less']
}
}
});
tasks.forEach((task) => {grunt.loadNpmTasks(task); });
grunt.registerTask('default', ['jshint', 'less', 'uglify', 'image']);
};