2015-08-29 15:24:20 +02:00
|
|
|
// Include Gulp
|
|
|
|
var gulp = require('gulp');
|
|
|
|
|
|
|
|
// Include required Gulp packages
|
|
|
|
var concat = require('gulp-concat'),
|
|
|
|
uglify = require('gulp-uglify'),
|
2015-09-03 09:31:04 +02:00
|
|
|
csslint = require('gulp-csslint'),
|
2015-08-29 15:24:20 +02:00
|
|
|
jshint = require('gulp-jshint'),
|
|
|
|
less = require('gulp-less'),
|
|
|
|
autoprefixer = require('gulp-autoprefixer'),
|
|
|
|
cssmin = require('gulp-cssmin'),
|
|
|
|
imagemin = require('gulp-imagemin'),
|
|
|
|
rename = require('gulp-rename')
|
|
|
|
;
|
|
|
|
|
|
|
|
// Global build task
|
|
|
|
gulp.task('build', [
|
|
|
|
'css',
|
2016-03-05 11:23:13 +01:00
|
|
|
'fonts',
|
2015-08-29 15:24:20 +02:00
|
|
|
'js',
|
|
|
|
'img',
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
2015-08-31 11:01:17 +02:00
|
|
|
// Watch task
|
|
|
|
gulp.task('watch', function(){
|
|
|
|
gulp.watch('js/*.js', ['js']);
|
|
|
|
gulp.watch('css/*.less', ['css']);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-08-29 15:24:20 +02:00
|
|
|
// JS task
|
|
|
|
gulp.task('js', function() {
|
|
|
|
return gulp.src([
|
2016-03-04 14:40:05 +01:00
|
|
|
'bower_components/jquery/dist/jquery.js',
|
|
|
|
'bower_components/js-cookie/js.cookie.js',
|
|
|
|
'bower_components/handlebars/handlebars.js',
|
|
|
|
'bower_components/sammy/lib/sammy.js',
|
|
|
|
'bower_components/sammy/lib/plugins/sammy.handlebars.js',
|
|
|
|
'bower_components/sammy/lib/plugins/sammy.json.js',
|
|
|
|
'bower_components/sammy/lib/plugins/sammy.storage.js',
|
|
|
|
'bower_components/bootstrap/dist/js/bootstrap.js',
|
2015-11-24 08:36:36 +01:00
|
|
|
'js/yunohost/y18n.js',
|
2016-02-04 12:14:37 +01:00
|
|
|
'js/yunohost/main.js',
|
2015-11-24 08:36:36 +01:00
|
|
|
'js/yunohost/helpers.js',
|
|
|
|
'js/yunohost/filters.js',
|
|
|
|
'js/yunohost/controllers/*.js',
|
2015-08-29 15:24:20 +02:00
|
|
|
])
|
|
|
|
.pipe(uglify())
|
|
|
|
.pipe(concat('script.min.js'))
|
|
|
|
.pipe(gulp.dest('./dist/js'))
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// JS Lint task
|
|
|
|
gulp.task('js-lint', function() {
|
|
|
|
return gulp.src('js/*.js')
|
|
|
|
.pipe(jshint())
|
|
|
|
.pipe(jshint.reporter('default'));
|
|
|
|
});
|
|
|
|
|
2016-03-05 11:23:13 +01:00
|
|
|
// Fonts
|
|
|
|
gulp.task('fonts', function() {
|
|
|
|
return gulp.src([
|
|
|
|
'bower_components/font-awesome/fonts/*',
|
|
|
|
'fonts/*'
|
|
|
|
])
|
|
|
|
.pipe(gulp.dest('./dist/fonts'))
|
|
|
|
});
|
2015-08-29 15:24:20 +02:00
|
|
|
|
|
|
|
// CSS task
|
|
|
|
gulp.task('css', function () {
|
|
|
|
return gulp.src('css/style.less')
|
|
|
|
.pipe(less())
|
|
|
|
.pipe(autoprefixer())
|
|
|
|
.pipe(rename({
|
|
|
|
suffix: '.min'
|
|
|
|
}))
|
|
|
|
.pipe(cssmin())
|
|
|
|
.pipe(gulp.dest('./dist/css'))
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-09-03 09:31:04 +02:00
|
|
|
// CSS/Less lint task
|
|
|
|
gulp.task('css-lint', function() {
|
|
|
|
return gulp.src('css/style.less')
|
|
|
|
.pipe(less())
|
|
|
|
.pipe(autoprefixer())
|
|
|
|
.pipe(csslint())
|
|
|
|
.pipe(csslint.reporter('compact'))
|
|
|
|
.pipe(gulp.dest('./css/'))
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-08-29 15:24:20 +02:00
|
|
|
// Images task
|
|
|
|
gulp.task('img', function () {
|
|
|
|
return gulp.src('img/*')
|
|
|
|
.pipe(imagemin())
|
|
|
|
.pipe(gulp.dest('./dist/img'))
|
|
|
|
});
|