forked from QubitProducts/bamboo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·90 lines (79 loc) · 2.05 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
"use strict";
var _ = require("lodash");
// Common Directories
var distDir = "webapp/dist";
var sassDir = "webapp/sass";
var appDir = "webapp/app";
module.exports = function (grunt) {
var pkg = grunt.file.readJSON('package.json');
var commonShims = pkg.shims;
var libSource = _.pluck(commonShims, 'path');
var libAlias = _.map(commonShims, function (shim, key) { return shim.path + ":" + key; });
console.log("Common Shims:");
_.map(libAlias, function (lib) { console.log(lib); });
grunt.initConfig({
pkg: pkg,
distDir: distDir,
sassDir: sassDir,
appDir: appDir,
browserify: {
libs: {
src: libSource,
dest: "<%= distDir %>/main-libs.js",
options: {
alias: libAlias,
shim: commonShims,
transform: ["uglifyify"]
}
},
app: {
src: ["<%= appDir %>/**/*.js"],
dest: "<%= distDir %>/main-app.js",
options: {
alias: libAlias,
external: libSource,
transform: ["partialify", "uglifyify"],
bundleOptions: {
debug: false
}
}
},
all: {
options: {
shim: commonShims,
alias: libAlias,
transform: ["partialify"]
},
src: ["<%= appDir %>/**/*.js"],
dest: "<%= distDir %>/main-bundle.js"
}
},
sass: {
dist: {
options: { // Target options
style: 'compressed'
},
files: {
'<%= distDir %>/main.css' : '<%= sassDir %>/main.scss'
}
}
},
watch: {
script: {
files: ['<%= appDir %>/**/*.js', '<%= appDir %>/**/*.html'],
tasks: ['browserify:app'],
options: {
spawn: false
}
},
sass: {
files: '<%= sassDir %>/**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.registerTask('default', ['browserify']);
}