-
Notifications
You must be signed in to change notification settings - Fork 10
/
Brocfile.js
74 lines (64 loc) · 2.25 KB
/
Brocfile.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
var concat = require('broccoli-concat');
var mergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
var lessCompiler = require('broccoli-less-single');
var replace = require('broccoli-string-replace');
var browserify = require('broccoli-fast-browserify');
var env = process.env.BROCCOLI_ENV || 'development';
// fix https://github.com/timschlechter/bootstrap-tagsinput/pull/377
var tagsinput = new Funnel('node_modules/bootstrap-tagsinput/src', { files: ['bootstrap-tagsinput.js'] });
tagsinput = replace(tagsinput, {
files: ['bootstrap-tagsinput.js'],
patterns: [{
match: /\.on\('typeahead:selected'/,
replacement: ".on('typeahead:selected typeahead:autocompleted'",
}],
});
var js = 'js/';
// Transpile and concatenate js and inline views via browserify.
// We use browserify instead of broccoli for transpilation to get correct source maps.
var views = new Funnel('views/', {
destDir: 'views/'
});
js = mergeTrees([tagsinput, js, views]);
js = browserify(js, {
browserify: {
debug: env === 'development' // source maps
},
bundles: {
'assets/scripts.js': {
transform: [require('babelify'), { tr: require('browserify-shim'), options: { global: true } }, require('brfs')],
entryPoints: ['main.js']
}
}
});
var css = mergeTrees([
'css/',
'less/',
'node_modules/bootstrap/less/',
'node_modules/bootstrap-tagsinput/dist',
'node_modules/bootstrap-datepicker/dist/css',
]);
css = lessCompiler(css, 'app.less', 'assets/styles.css');
var fonts = 'fonts/';
fonts = new Funnel(fonts, {
include: ['*.woff', '*.ttf'],
destDir: '/fonts'
});
var images = 'images/';
images = new Funnel(images, {
include: ['*.png'],
destDir: '/images'
});
var index = new Funnel('views/', {
files: ['index.html']
});
// the pdf.js node packages don't include a viewer, and it's too much of a hassle to write and maintain one,
// so we instead use the default viewer, which is only distributed with the zip file.
// see http://mozilla.github.io/pdf.js/ if you want to update the included viewer.
// Unzipping a new release into an emptied pdfjs/ directory should work.
var pdfjs = new Funnel('pdfjs/', {
exclude: ['LICENSE'],
destDir: '/pdfjs'
});
module.exports = mergeTrees([js, css, fonts, images, index, pdfjs]);