-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.js
60 lines (55 loc) · 2.28 KB
/
bootstrap.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
var async = require('async')
, compressor = require('node-minify');
module.exports = Bootstrap = function(gConfig, logger, next) {
/* If deployed in production never run resource compression routine.
also CWD to the service installation directory on windows only */
if (process.argv.length > 2) {
logger.info("PROD mode detected, skipping css/js compression bootstaps module..")
logger.info('CWD before: ' + process.cwd());
process.chdir('C:\node-app\spof\app');
logger.info('CWD after: ' + process.cwd());
next(null);
} else {
logger.info("DEV mode detected..")
async.parallel({
one: function(callback) {
new compressor.minify({
type: 'yui-js',
fileIn: ['./public/assets/js/jquery/jquery-1.8-min.js',
'./public/assets/js/underscore/underscore-min.js',
'./public/assets/js/bootstrap/bootstrap-dropdown.js',
'./public/assets/js/bootstrap/bootstrap-button.js',
'./public/assets/js/bootstrap/bootstrap-collapse.js',
'./public/assets/js/bootstrap/bootstrap-tooltip.js',
'./public/assets/js/bootstrap/bootstrap-popover.js',
'./public/assets/js/google-code-prettify/prettify.js',
'./public/assets/js/application.js'],
fileOut: './public/assets/js/one-js.js',
callback: function(err) {
logger.info("YUI Compressing JS files..");
if (err) { console.log("Error compressing JS files: " + err);}
callback(null);
}
});
},
two: function(callback) {
new compressor.minify({
type: 'yui',
fileIn: ['./public/assets/css/bootstrap/bootstrap.css',
'./public/assets/css/bootstrap/bootstrap-responsive.css',
'./public/assets/css/docs.css',
'./public/assets/css/google-code-prettify/prettify.css'],
fileOut: './public/assets/css/one-css.css',
callback: function(err) {
logger.info("YUI Compressing CSS files..");
if (err) { console.log("Error compressing CSS files: " + err);}
callback(null);
}
});
}
},
function(err, results) {
next(null);
});
}
};