forked from allcount/allcountjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
29 lines (26 loc) · 1.02 KB
/
gulpfile.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
var gulp = require('gulp');
var injection = require('./services/injection');
require('./allcount-server.js');
var _ = require('underscore');
var path = require('path');
var Q = require('q');
function buildScripts() {
var assetsService = injection.inject('assetsService');
var assetsMinifier = injection.inject('assetsMinifier');
return Q.all(_.map(assetsService.scripts, function (scriptPaths, url) {
var buildPath = assetsMinifier.buildPath();
var absoluteScriptPaths = scriptPaths.map(function (p) {
return path.join(assetsMinifier.defaultPublicPath(), p)
});
return assetsMinifier.scriptHash(url, absoluteScriptPaths).then(function (hash) {
var buildScriptPath = path.join(buildPath, assetsMinifier.hashPath(url, hash));
return assetsMinifier.minify(absoluteScriptPaths, buildScriptPath);
})
}));
}
module.exports = function (gulp) {
gulp.task('build-allcountjs', function() {
return buildScripts();
});
};
module.exports(gulp);