From d7e7ba30ba528c9842050894d97e9d2137267eed Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 3 Jun 2020 23:02:39 +0200 Subject: [PATCH] Gulp Upgrade --- src/gulpfile.js | 75 ++++++++++++++++++++++++------------------------ src/package.json | 26 ++++++++--------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/gulpfile.js b/src/gulpfile.js index e5f183e8..5dd1dbbc 100644 --- a/src/gulpfile.js +++ b/src/gulpfile.js @@ -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')); +}); \ No newline at end of file diff --git a/src/package.json b/src/package.json index e53ac632..7de80a95 100644 --- a/src/package.json +++ b/src/package.json @@ -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" + }, } }