Project

General

Profile

Download (1.75 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / flarecast / workspace / client-user-3.0 / gulpfile.js @ master

1
var gulp = require('gulp');
2
var concat = require('gulp-concat');
3
var uglify = require('gulp-uglifyjs');
4
var fs = require("fs");
5

    
6
/**
7
 * Build client-user application without any plugins file
8
 */
9
gulp.task('default', function() {
10
    var cwd = process.cwd();
11

    
12
    // read file list 
13
    fs.readFile(cwd + "/conf/files.json", "utf-8", function (err, _data) {
14
         if (err) {
15
             console.log("Error: " + err);
16
             return;
17
         }
18
         
19
         // parse the file list as a JSON Object
20
         data = JSON.parse(_data);
21
         
22
         // Build the sources
23
        gulp.src(data)
24
            // concatenate all files into admin.all.js
25
            .pipe(concat("app.all.js"))
26
            .pipe(gulp.dest("dist/"))
27
            // uglify all files into admin.min.js
28
            .pipe(uglify("app.min.js"))
29
            .pipe(gulp.dest("dist/"));
30
            // both files are created into the dist folder
31
    });
32
});
33

    
34
/**
35
 * Build client-user application with all plugins
36
 */
37
gulp.task('build-with-plugins', function() {
38
    var cwd = process.cwd();
39

    
40
    // read file list 
41
    fs.readFile(cwd + "/conf/files-with-plugins.json", "utf-8", function (err, _data) {
42
         if (err) {
43
             console.log("Error: " + err);
44
             return;
45
         }
46
         
47
         // parse the file list as a JSON Object
48
         data = JSON.parse(_data);
49
         
50
         // Build the sources
51
        gulp.src(data)
52
            // concatenate all files into admin.all.js
53
            .pipe(concat("app.withPlugins.all.js"))
54
            .pipe(gulp.dest("dist/"))
55
            // uglify all files into admin.min.js
56
            .pipe(uglify("app.withPlugins.min.js"))
57
            .pipe(gulp.dest("dist/"));
58
            // both files are created into the dist folder
59
    });
60
});