Gulp Upgrade

This commit is contained in:
Kay0u 2020-06-03 23:02:39 +02:00 committed by Alexandre Aubin
parent d61d5ce0f7
commit d7e7ba30ba
2 changed files with 51 additions and 50 deletions

View file

@ -6,6 +6,7 @@ var concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
csslint = require('gulp-csslint'),
jshint = require('gulp-jshint'),
mustache = require('gulp-mustache'),
less = require('gulp-less'),
autoprefixer = require('gulp-autoprefixer'),
cssmin = require('gulp-cssmin'),
@ -19,35 +20,18 @@ var concat = require('gulp-concat'),
isDev = (util.env.dev) ? true : false;
isProduction = !isDev;
// Global build task
gulp.task('build', [
'css',
'fonts',
'js',
'img',
]);
// Watch task
gulp.task('watch', function(){
gulp.watch('js/**/*.js', ['js']);
gulp.watch('css/*.less', ['css']);
});
// JS task
gulp.task('js', function() {
return gulp.src([
'bower_components/jquery/dist/jquery.js',
'bower_components/js-cookie/src/js.cookie.js',
'bower_components/handlebars/handlebars.js',
'bower_components/handlebars-helper-intl/dist/handlebars-intl-with-locales.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',
'bower_components/isotope-layout/dist/isotope.pkgd.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/handlebars/dist/handlebars.js',
'node_modules/handlebars-intl/dist/handlebars-intl-with-locales.js',
'node_modules/sammy/lib/sammy.js',
'node_modules/sammy/lib/plugins/sammy.handlebars.js',
'node_modules/sammy/lib/plugins/sammy.json.js',
'node_modules/sammy/lib/plugins/sammy.storage.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'node_modules/isotope-layout/dist/isotope.pkgd.js',
'js/yunohost/y18n.js',
'js/yunohost/main.js',
'js/yunohost/helpers.js',
@ -71,17 +55,17 @@ gulp.task('js-lint', function() {
// Fonts
gulp.task('fonts', function() {
return gulp.src([
'bower_components/fork-awesome/fonts/*',
'bower_components/source-code-pro/EOT/*.eot',
'bower_components/source-code-pro/OTF/*.otf',
'bower_components/source-code-pro/TTF/*.ttf',
'bower_components/source-code-pro/WOFF/OTF/*.woff',
'bower_components/source-code-pro/WOFF2/TTF/*.woff2',
'bower_components/source-sans-pro/EOT/*.eot',
'bower_components/source-sans-pro/OTF/*.otf',
'bower_components/source-sans-pro/TTF/*.ttf',
'bower_components/source-sans-pro/WOFF/OTF/*.woff',
'bower_components/source-sans-pro/WOFF2/TTF/*.woff2',
'node_modules/fork-awesome/fonts/*',
'node_modules/source-code-pro/EOT/*.eot',
'node_modules/source-code-pro/OTF/*.otf',
'node_modules/source-code-pro/TTF/*.ttf',
'node_modules/source-code-pro/WOFF/OTF/*.woff',
'node_modules/source-code-pro/WOFF2/TTF/*.woff2',
'node_modules/source-sans-pro/EOT/*.eot',
'node_modules/source-sans-pro/OTF/*.otf',
'node_modules/source-sans-pro/TTF/*.ttf',
'node_modules/source-sans-pro/WOFF/OTF/*.woff',
'node_modules/source-sans-pro/WOFF2/TTF/*.woff2',
])
.pipe(gulp.dest('./dist/fonts'))
});
@ -116,3 +100,20 @@ gulp.task('img', function () {
.pipe(gulpif(isProduction, imagemin()))
.pipe(gulp.dest('./dist/img'))
});
// Views task
gulp.task('views', function () {
return gulp.src('views/**/*.ms')
.pipe(gulp.dest("./dist/views"));
});
// Global build task
gulp.task('build', gulp.series('css', 'fonts', 'js', 'img', 'views'));
// Watch task
gulp.task('watch', function() {
gulp.watch('js/**/*.js', gulp.series('js'));
gulp.watch('css/*.less', gulp.series('css'));
gulp.watch('views/**/*.ms', gulp.series('views'));
});

View file

@ -18,18 +18,18 @@
},
"homepage": "https://github.com/YunoHost/yunohost-admin",
"devDependencies": {
"bower": "^1.7.7",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-csslint": "^0.2.0",
"gulp-cssmin": "^0.1.7",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^2.3.0",
"gulp-jshint": "^1.11.2",
"gulp-less": "^3.0.3",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.7"
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-concat": "^2.6.1",
"gulp-csslint": "^1.0.1",
"gulp-cssmin": "^0.2.0",
"gulp-if": "^3.0.0",
"gulp-imagemin": "^7.1.0",
"gulp-jshint": "^2.1.0",
"gulp-less": "^4.0.1",
"gulp-rename": "^2.0.0",
"gulp-uglify": "^3.0.2",
"gulp-mustache": "^5.0.0"
},
}
}