This repository was archived by the owner on Jul 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntfile.js
More file actions
117 lines (113 loc) · 3.8 KB
/
Gruntfile.js
File metadata and controls
117 lines (113 loc) · 3.8 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
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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// JS
concat: {
development: {
files: {
'build/app/webroot/js/libs.js': ['src/app/webroot/js/libs/jquery/jquery.js', 'src/app/webroot/js/libs/**/*.js'],
'build/app/webroot/js/<%= pkg.name %>.js': 'src/app/webroot/js/scripts/**/*.js'
}
},
production: {
files: {
'release/app/webroot/js/libs.js': ['src/app/webroot/js/libs/jquery/jquery.js', 'src/app/webroot/js/libs/**/*.js'],
'release/app/webroot/js/<%= pkg.name %>.js': 'src/app/webroot/js/scripts/**/*.js'
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
project: {
src: 'release/app/webroot/js/<%= pkg.name %>.js',
dest: 'release/app/webroot/js/<%= pkg.name %>.min.js'
},
libs: {
src: 'release/app/webroot/js/libs.js',
dest: 'release/app/webroot/js/libs.min.js'
}
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js'],
options: {
globals: {
jQuery: true,
console: false,
module: true,
document: true
}
}
},
// CSS
sass: {
development: {
files: {
'build/app/webroot/css/<%= pkg.name %>.css': 'src/app/webroot/scss/style.scss'
}
},
production: {
files: {
'release/app/webroot/css/<%= pkg.name %>.css': 'src/app/webroot/scss/style.scss'
}
}
},
csslint: {
scssoutput: {
options: {
'vendor-prefix': false,
'adjoining-classes': false
},
src: ['release/app/webroot/css/<%= pkg.name %>.css']
}
},
cssmin: {
compress: {
options: {
banner: '/* <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */'
},
files: {
'release/app/webroot/css/<%= pkg.name %>.min.css': 'release/app/webroot/css/<%= pkg.name %>.css'
}
}
},
// General
copy: {
development: {
files: [
{expand: true, cwd: 'src/', src: ['*'], dest: 'build/', filter: 'isFile'},
{expand: true, cwd: 'src/', src: ['app/**'], dest: 'build/'},
{expand: true, cwd: 'src/',src: ['lib/**'], dest: 'build/'},
{expand: true, cwd: 'src/',src: ['plugins/**'], dest: 'build/'},
{expand: true, cwd: 'src/',src: ['vendors/**'], dest: 'build/'}
]
},
production: {
files: [
{expand: true, cwd: 'src/', src: ['*'], dest: 'release/', filter: 'isFile'},
{expand: true, cwd: 'src/', src: ['app/**'], dest: 'release/'},
{expand: true, cwd: 'src/',src: ['lib/**'], dest: 'release/'},
{expand: true, cwd: 'src/',src: ['plugins/**'], dest: 'release/'},
{expand: true, cwd: 'src/',src: ['vendors/**'], dest: 'release/'}
]
},
},
watch: {
files: 'src/**/*',
tasks: ['sass', 'concat', 'copy']
}
});
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('minify', ['sass:production', 'concat:production', 'cssmin', 'uglify']);
grunt.registerTask('build', ['sass:development', 'concat:development', 'copy:development']);
grunt.registerTask('release', ['sass:production', 'concat:production', 'cssmin', 'uglify', 'copy:production']);
};