-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
executable file
·119 lines (115 loc) · 3.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
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
//----------------------------------------------------------------------------------------------------------------------
// LDSGLights Gruntfile.
//----------------------------------------------------------------------------------------------------------------------
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
build: {
css: "build/css",
js: "build/js"
},
project: {
index: "client/index.html",
less_dir: "client/less",
less: "<%= project.less_dir %>/*.less",
js_dir: "client/js",
js: "<%= project.js_dir %>/*.js",
flatpages_dir: "client/flatpages",
flatpages: "<%= project.flatpages_dir %>/**/*.tpl.html"
},
html2js: {
lightsite: {
src: ['client/**/*.tpl.html'],
dest: '<%= build.js %>/templates.js',
options: {
base: 'client',
module: 'lightsite.templates',
rename: function (moduleName) {
return '/' + moduleName.replace('.tpl', '');
}
}
}
},
less: {
dev: {
options: {
paths: ['client/less', 'vendor']
},
files: {
'<%= build.css %>/light-site.css': ['<%= project.less %>', '<%= project.flatpages_dir %>/**/*.less']
}
},
min: {
options: {
paths: ['client/less', 'vendor'],
compress: true
},
files: {
'<%= build.css %>/light-site.css': ['<%= project.less %>', '<%= project.flatpages_dir %>/**/*.less']
}
}
},
develop: {
server: {
file: 'server.js'
}
},
clean: ["build/index.html", "build/app.js"],
copy: {
lightsite: {
src: '../<%= project.index %>',
expand: true,
cwd: 'build',
flatten: true,
dest: 'build/'
},
app: {
src: '../client/*.js',
expand: true,
cwd: 'build',
flatten: true,
dest: 'build/'
}
},
watch: {
lightsite: {
files: ['server.js', 'server/**/*.js'],
tasks: ['develop'],
options: {
atBegin: true,
nospawn: true
}
},
copy: {
files: ['client/index.html', 'client/*.js'],
tasks: ['clean', 'copy'],
options: {
atBegin: true
}
},
html2js: {
files: ['client/**/*.tpl.html'],
tasks: ['html2js'],
options: {
atBegin: true
}
},
less: {
files: ['<%= project.less %>', '<%= project.flatpages_dir %>/**/*.less'],
tasks: ['less'],
options: {
atBegin: true
}
}
}
});
// Grunt Tasks.
grunt.loadNpmTasks('grunt-develop');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('build', ['clean', 'less', 'systems_js', 'html2js']);
};