-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
130 lines (124 loc) · 3.48 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
120
121
122
123
124
125
126
127
128
129
130
module.exports = function (grunt) {
require( 'jit-grunt' )( grunt );
colorSchemes = {
blue: {
primaryColor: '#1d5f7b',
breadcrumbHighlight: '#113849',
cameraBulletColor: '#1d5f7b',
darkHighlight: '#113849',
lightHighlight: '#8ccae4',
linkHighlightColor: '#1d5f7b',
navLinkBackgroundColor: '#8ccae4',
navLinkTextColor: '#333',
coloredBackgroundLinkColor: '#8ccae4',
coloredBackgroundTextColor: '#fff',
loginForegroundColor: '#1d5f7b',
loginBackgroundColor: '#8ccae4',
loginTextColor: '#fff',
siteLinkColor: '#444'
},
green: {
primaryColor: '#b6d498',
cameraBulletColor: '#333',
breadcrumbHighlight: '#d4e6c3',
darkHighlight: '#9fd764',
lightHighlight: '#9fd764',
linkHighlightColor: '#b6d498',
navLinkBackgroundColor: '#b6d498',
navLinkTextColor: '#333',
coloredBackgroundLinkColor: '#b6d498',
coloredBackgroundTextColor: '#333',
loginForegroundColor: '#d4e6c3',
loginBackgroundColor: '#b6d498',
loginTextColor: '#333',
siteLinkColor: '#444'
},
red: {
primaryColor: '#a9280e',
cameraBulletColor: '#fff',
breadcrumbHighlight: '#95230c',
darkHighlight: '#8c210b',
lightHighlight: '#fbd8d1',
linkHighlightColor: '#a9280e',
navLinkBackgroundColor: '#a9280e',
navLinkTextColor: '#fff',
coloredBackgroundLinkColor: '#a9280e',
coloredBackgroundTextColor: '#fff',
loginForegroundColor: '#a9280e',
loginBackgroundColor: '#c42e10',
loginTextColor: '#fff',
siteLinkColor: '#444'
}
};
var lessTasks = {}
var colorSchemePath = '';
var colorSchemeTasks = [];
for ( color in colorSchemes ) {
colorSchemePath = 'css/color-schemes/' + color + '.css';
toolbarColorSchemePath = 'css/color-schemes/toolbar-' + color + '.css';
lessTasks[ color ] = {
options: {
modifyVars: colorSchemes[ color ],
optimization: 2
},
files: {}
}
lessTasks[ color ].files[ colorSchemePath ] = 'style.less';
lessTasks[ color ].files[ toolbarColorSchemePath ] = 'less/openlab-toolbar.less';
colorSchemeTasks.push( 'less:' + color );
};
var timestamp = new Date().getTime();
grunt.initConfig(
{
pkg: grunt.file.readJSON( 'package.json' ),
concat: {
options: {
separator: ';'
},
vendor: {
src: ['js/bootstrap.min.js',
'node_modules/jcarousellite/jcarousellite.js',
'js/easyaccordion.js',
'js/jquery.easing.1.3.js',
'js/camera.mod.js',
'js/jQuery.succinct.mod.js',
'js/detect-zoom.js'],
dest: 'js/dist/vendor.js'
},
},
less: lessTasks,
watch: {
styles: {
files: ['*.less', 'less/*.less'], // which files to watch
tasks: ['less'],
options: {
nospawn: true
}
},
scripts: {
files: ['js/*.js'],
tasks: ['concat'],
options: {
nospawn: true
}
}
},
setPHPConstant: {
version: {
constant: 'OPENLAB_VERSION',
value: '<%= pkg.version %>-' + timestamp,
file: 'functions.php'
}
},
}
);
grunt.loadNpmTasks( 'grunt-contrib-less' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-php-set-constant' );
var taskList = ['concat', 'watch', 'less', 'setPHPConstant'];
taskList = taskList.concat( colorSchemeTasks );
var defaultTasks = ['concat', 'less', 'setPHPConstant'];
grunt.registerTask( 'default', defaultTasks );
};