-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
119 lines (102 loc) · 3.08 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
styles: {
files: ['js/*.js', 'js/*/*.js', 'css/**/*.less', 'css/*.less'],
tasks: ['recess:dev', 'concat'],
options: {
nospawn: true
}
}
},
//our concat options
concat: {
options: {
separator: ';' //separates scripts
},
basic_and_extras: {
files: {
'js/plugins.js': ['js/**/*.js']
}
}
},
//our uglify options
uglify: {
js: {
files: {
'build/js/main.js': ['js/main.js', 'js/plugins.js']
}
}
},
recess: {
dev: {
options: {
compile: true,
// compress: true
},
files: {
'css/main.css': ['css/main.less']
}
},
build: {
options: {
compile: true,
compress: true
},
files: {
'build/css/main.css': ['css/main.less']
}
}
},
htmlmin: { // Task
dist: { // Target
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'build/index.html': 'index.html', // 'destination': 'source'
}
}
},
// usemin for html file
usemin: {
html: ['index.html']
},
copy: {
main: {
files: [
{expand: true, src: ['fonts/**'], dest: 'build/'},
{expand: true, src: ['js/vendor/*'], dest: 'build/'},
{expand: true, src: ['img/*'], dest: 'build/'},
{expand: false, src: ['package.json'], dest: 'build/package.json', filter: 'isFile'},
{expand: false, src: ['config.json'], dest: 'build/config.json', filter: 'isFile'},
{expand: false, src: ['favicon.png'], dest: 'build/favicon.png', filter: 'isFile'},
{expand: false, src: ['.nodemonignore'], dest: 'build/.nodemonignore', filter: 'isFile'},
{expand: false, src: ['porutalu-comingsoon.js'], dest: 'build/porutalu-comingsoon.js', filter: 'isFile'},
]
}
},
symlink: {
explicit:{src: 'node_modules', dest: 'build/node_modules'}
},
clean: {
dev: ["js/plugins.js"],
build: ["build/*"]
},
});
// grunt.loadNpmTasks('grunt-contrib-jshint');
// grunt.loadNpmTasks('grunt-contrib-concat');
// grunt.loadNpmTasks('grunt-contrib-uglify');
// grunt.loadNpmTasks('grunt-contrib-clean');
// grunt.loadNpmTasks('grunt-recess');
// grunt.loadNpmTasks('grunt-contrib-watch');
/**
* Dynamically load npm tasks
*/
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
//default tasks to run
grunt.registerTask('compile', ['clean:build', 'recess:build', 'concat', 'uglify', 'copy:main', 'usemin', 'htmlmin','symlink']);
grunt.registerTask('dev', ['clean:dev', 'recess:dev', 'concat', 'watch']);
};