This repository was archived by the owner on Sep 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
executable file
·80 lines (68 loc) · 2.18 KB
/
Gruntfile.js
File metadata and controls
executable file
·80 lines (68 loc) · 2.18 KB
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
'use strict';
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Configurable paths
var config = {
app: '.',
dist: '.',
bower: '<%= config.app %>/lib',
use_map: false
};
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
config: config,
pkg: grunt.file.readJSON('package.json'),
// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: ['<%= config.app %>/app/{,*/}*.js'],
tasks: ['uglify']
},
styles: {
files: ['<%= config.app %>/less/{,*/}*.less'], // which files to watch
tasks: ['less']
}
},
less: {
files: {
expand: true,
cwd: '<%= config.dist %>/less',
src: ['*.less'],
dest: '<%= config.dist %>/css/',
ext: '.css'
}
},
// Uglify javascripts
uglify: {
all_src : {
options: {
banner: "/*!\n<%= pkg.name %> v<%= pkg.version %>\n" +
'© 2014-<%= grunt.template.today("yyyy") %> <%= pkg.author %>, http://coders.lt\n' +
'License: <%= pkg.license %>\n' +
'*/',
mangle: false,
sourceMap : true,
sourceMapName : '<%= config.dist %>/js/sourceMap.map'
},
src : '<%= config.app %>/app/{,*/}*.js',
dest : '<%= config.dist %>/js/app.min.js'
}
},
// Clean old releases files before deployment. These files are generated again on each deployment.
clean: {
old: [
'<%= config.dist %>/js',
'<%= config.dist %>/css'
]
}
});
grunt.registerTask('default', [
'clean:old',
'less',
'uglify'
]);
};