forked from litecart/litecart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
173 lines (162 loc) · 5.86 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
replace: {
app_header: {
src: ['public_html/includes/app_header.inc.php'],
overwrite: true,
replacements: [
{
from: /define\('PLATFORM_VERSION', '([0-9\.]+)'\);/,
to: 'define(\'PLATFORM_VERSION\', \'<%= pkg.version %>\');'
}
]
},
index: {
src: ['public_html/index.php'],
overwrite: true,
replacements: [
{
from: /LiteCart® ([0-9\.]+)/,
to: 'LiteCart® <%= pkg.version %>'
}
]
},
},
less: {
litecart_admin_template_minified: {
options: {
compress: true,
sourceMap: true,
sourceMapBasepath: 'public_html/includes/templates/default.admin/less/',
sourceMapRootpath: '../less/',
sourceMapURL: function(path) { return path.replace(/.*\//, '') + '.map'; },
relativeUrls: true
},
files: {
'public_html/includes/templates/default.admin/css/app.min.css' : 'public_html/includes/templates/default.admin/less/app.less',
'public_html/includes/templates/default.admin/css/framework.min.css' : 'public_html/includes/templates/default.admin/less/framework.less',
'public_html/includes/templates/default.admin/css/printable.min.css' : 'public_html/includes/templates/default.admin/less/printable.less',
}
},
litecart_catalog_template: {
options: {
compress: false,
sourceMap: false,
relativeUrls: true
},
files: {
'public_html/includes/templates/default.catalog/css/app.css' : 'public_html/includes/templates/default.catalog/less/app.less',
'public_html/includes/templates/default.catalog/css/checkout.css' : 'public_html/includes/templates/default.catalog/less/checkout.less',
'public_html/includes/templates/default.catalog/css/framework.css' : 'public_html/includes/templates/default.catalog/less/framework.less',
'public_html/includes/templates/default.catalog/css/printable.css' : 'public_html/includes/templates/default.catalog/less/printable.less',
}
},
litecart_catalog_template_minified: {
options: {
compress: true,
sourceMap: true,
sourceMapBasepath: 'public_html/includes/templates/default.catalog/less/',
sourceMapRootpath: '../less/',
sourceMapURL: function(path) { return path.replace(/.*\//, '') + '.map'; },
relativeUrls: true
},
files: {
'public_html/includes/templates/default.catalog/css/app.min.css' : 'public_html/includes/templates/default.catalog/less/app.less',
'public_html/includes/templates/default.catalog/css/checkout.min.css' : 'public_html/includes/templates/default.catalog/less/checkout.less',
'public_html/includes/templates/default.catalog/css/framework.min.css' : 'public_html/includes/templates/default.catalog/less/framework.less',
'public_html/includes/templates/default.catalog/css/printable.min.css' : 'public_html/includes/templates/default.catalog/less/printable.less',
}
},
featherlight_minified: {
options: {
compress: true,
sourceMap: true,
sourceMapBasepath: 'public_html/ext/featherlight/',
sourceMapRootpath: './',
sourceMapURL: function(path) { return path.replace(/.*\//, '') + '.map'; },
relativeUrls: true
},
files: {
'public_html/ext/featherlight/featherlight.min.css' : 'public_html/ext/featherlight/featherlight.less',
}
},
},
sass: {
trumbowyg_minified: {
options: {
implementation: require('node-sass'),
sourceMap: true,
outputStyle: 'compressed',
compass: false
},
files: {
'public_html/ext/trumbowyg/ui/trumbowyg.min.css': 'public_html/ext/trumbowyg/ui/trumbowyg.scss'
}
}
},
uglify: {
featherlight: {
options: {
sourceMap: true,
},
files: {
'public_html/ext/featherlight/featherlight.min.js' : ['public_html/ext/featherlight/featherlight.js'],
}
},
litecart: {
options: {
sourceMap: true,
},
files: {
'public_html/includes/templates/default.admin/js/app.min.js' : ['public_html/includes/templates/default.admin/js/app.js'],
'public_html/includes/templates/default.catalog/js/app.min.js' : ['public_html/includes/templates/default.catalog/js/app.js'],
}
},
},
phplint: {
options: {
//phpCmd: 'C:/xampp/php/php.exe', // Defaults to php
limit: 10,
stdout: false
},
files: 'public_html/**/*.php'
},
watch: {
replace: {
files: [
'package.json',
],
tasks: ['replace']
},
less: {
files: [
'public_html/ext/featherlight/featherlight.less',
'public_html/includes/templates/**/*.less',
],
tasks: ['less']
},
javascripts: {
files: [
'public_html/ext/featherlight/featherlight.js',
'public_html/includes/templates/**/js/*.js',
],
tasks: ['uglify']
},
sass: {
files: [
'public_html/ext/trumbowyg/ui/trumbowyg.scss',
],
tasks: ['sass']
},
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('default', ['replace', 'less', 'sass', 'uglify']);
require('phplint').gruntPlugin(grunt);
grunt.registerTask('test', ['phplint']);
};