This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
49 lines (45 loc) · 1.67 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
var gulp = require('gulp');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var declare = require('gulp-declare');
var handlebars = require('gulp-handlebars');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var wrap = require('gulp-wrap');
gulp.task('clean-dist', function () {
gulp.src('dist', { read: false })
.pipe(clean());
});
gulp.task('templates', function () {
gulp.src('src/template.hbs')
.pipe(handlebars({
handlebars: require('ember-handlebars')
/*outputType: 'browser',
processName: function () {
return 'components/ember-twbs-pagination';
}*/
}))
.pipe(wrap('Ember.Handlebars.template(<%= contents %>)'))
.pipe(declare({
namespace: 'Ember.TEMPLATES',
noRedeclare: true, // Avoid duplicate declarations
processName: function () {
return 'components/ember-twbs-pagination';
}
}))
.pipe(rename('ember-twbs-pagination.template.js'))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename('ember-twbs-pagination.template.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('scripts', function () {
gulp.src(['src/item-controller.js', 'src/component.js', 'src/initializer.js'])
.pipe(concat('ember-twbs-pagination.js'))
.pipe(wrap('(function (Ember) {\n<%= contents %>\n}(window.Ember));'))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename('ember-twbs-pagination.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['clean-dist', 'templates', 'scripts']);