forked from CodeCorico/ractive-require
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (35 loc) · 1.08 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
'use strict';
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglifyjs'),
insert = require('gulp-insert'),
packagejson = require('./package.json'),
header = '/*! Ractive-Require (' + packagejson.version + '). (C) ' + new Date().getFullYear() + ' CodeCorico. MIT @license: en.wikipedia.org/wiki/MIT_License */\r\n',
files = [
'features/get/get.js',
'features/controller/controller.js',
'features/require/require.js'
];
gulp.task('default', ['build', 'watch']);
gulp.task('build', function() {
gulp
.src(files)
.pipe(concat('ractive-require.js', {
newLine: '\r\n'
}))
.pipe(insert.prepend(header))
.pipe(gulp.dest('./dist'))
.pipe(uglify('ractive-require.min.js', {
outSourceMap: true
}))
.pipe(insert.transform(function(contents) {
if (contents.substr(0, 1) != '{') {
contents = header + contents;
}
return contents;
}))
.pipe(gulp.dest('./dist'));
});
gulp.task('watch', function() {
gulp.watch('./features/**/*.js', ['build']);
});