-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·61 lines (51 loc) · 1.78 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
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
"use strict"
// -- DEPENDENCIES -------------------------------------------------------------
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');
var header = require('gulp-header');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var pkg = require('./package.json');
// -- FILES --------------------------------------------------------------------
var path = {
build : './www/assets'};
var source = {
coffee: [ 'source/entities/*.coffee',
'source/atoms/*.coffee',
'source/molecules/*.coffee',
'source/organisms/*.coffee',
'source/*.coffee',
'source/*.*.coffee']};
var dependencies = {
js:[ 'bower_components/jquery/dist/jquery.min.js']};
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @author <%= pkg.author.name %> (<%= pkg.author.site %>)',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
// -- TASKS --------------------------------------------------------------------
gulp.task('coffee', function() {
gulp.src(source.coffee)
.pipe(concat('atoms.' + pkg.name + '.coffee'))
.pipe(coffee().on('error', gutil.log))
.pipe(uglify({mangle: false}))
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest(path.build + '/js'))
});
gulp.task('dependencies', function() {
gulp.src(dependencies.js)
.pipe(concat('atoms.' + pkg.name + '.dependencies.js'))
.pipe(uglify({mangle: false}))
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest(path.build + '/js'))
});
gulp.task('default', function() {
gulp.watch(source.coffee, ['coffee']);
});
gulp.task('init', function() {
gulp.run(['dependencies', 'coffee'])
});