mirror of https://github.com/snachodog/mybuddy.git
Refactor gulp tasks as a directory (WIP).
This commit is contained in:
parent
50bf6b9a15
commit
b0f552f3f8
125
gulpfile.js
125
gulpfile.js
|
@ -1,125 +0,0 @@
|
|||
var gulp = require('gulp');
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var csso = require('gulp-csso');
|
||||
var pump = require('pump');
|
||||
var sass = require('gulp-sass');
|
||||
var sassGlob = require('gulp-sass-glob');
|
||||
var uglify = require('gulp-uglify');
|
||||
|
||||
/* APP FILES */
|
||||
|
||||
gulp.task('app:scripts', function() {
|
||||
return gulp.src([
|
||||
'babyblotter/static_site/js/babyblotter.js',
|
||||
'api/static/js/*.js',
|
||||
'core/static/js/*.js',
|
||||
'dashboard/static/js/*.js'
|
||||
])
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulp.dest('babyblotter/static/babyblotter/js/'));
|
||||
});
|
||||
|
||||
gulp.task('app:styles', function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static_site/scss/babyblotter.scss'),
|
||||
sassGlob(),
|
||||
sass().on('error', sass.logError),
|
||||
concat('app.css'),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('app', ['app:scripts', 'app:styles']);
|
||||
|
||||
/* VENDOR FILES */
|
||||
|
||||
gulp.task('vendor:scripts', function() {
|
||||
return gulp.src([
|
||||
'node_modules/jquery/dist/jquery.js',
|
||||
'node_modules/popper.js/dist/umd/popper.js',
|
||||
'node_modules/bootstrap/dist/js/bootstrap.js',
|
||||
'node_modules/moment/moment.js',
|
||||
'node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js'
|
||||
])
|
||||
.pipe(concat('vendor.js'))
|
||||
.pipe(gulp.dest('babyblotter/static/babyblotter/js/'));
|
||||
});
|
||||
|
||||
gulp.task('vendor:styles', function() {
|
||||
return gulp.src([
|
||||
//'node_modules/bootstrap/dist/css/bootstrap.css',
|
||||
'node_modules/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.css',
|
||||
'node_modules/font-awesome/css/font-awesome.css'
|
||||
])
|
||||
.pipe(concat('vendor.css'))
|
||||
.pipe(gulp.dest('babyblotter/static/babyblotter/css/'));
|
||||
});
|
||||
|
||||
gulp.task('vendor:fonts', function() {
|
||||
return gulp.src([
|
||||
'node_modules/font-awesome/fonts/*'
|
||||
])
|
||||
.pipe(gulp.dest('babyblotter/static/babyblotter/fonts/'));
|
||||
});
|
||||
|
||||
gulp.task('vendor', ['vendor:styles', 'vendor:scripts', 'vendor:fonts']);
|
||||
|
||||
/* COMPRESSION */
|
||||
|
||||
gulp.task('compress:app:scripts', ['app:scripts'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/js/app.js'),
|
||||
concat('app.min.js'),
|
||||
uglify(),
|
||||
gulp.dest('babyblotter/static/babyblotter/js/')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('compress:app:styles', ['app:styles'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/css/app.css'),
|
||||
concat('app.min.css'),
|
||||
csso(),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('compress:vendor:scripts', ['vendor:scripts'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/js/vendor.js'),
|
||||
concat('vendor.min.js'),
|
||||
uglify(),
|
||||
gulp.dest('babyblotter/static/babyblotter/js/')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('compress:vendor:styles', ['vendor:styles'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/css/vendor.css'),
|
||||
concat('vendor.min.css'),
|
||||
csso(),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('compress', [
|
||||
'compress:app:scripts',
|
||||
'compress:app:styles',
|
||||
'compress:vendor:scripts',
|
||||
'compress:vendor:styles'
|
||||
]);
|
||||
|
||||
/* DEFAULT */
|
||||
|
||||
gulp.task('default', ['vendor', 'app', 'compress']);
|
|
@ -0,0 +1,4 @@
|
|||
const requireDir = require('require-dir');
|
||||
|
||||
|
||||
requireDir('./tasks', { recurse: true });
|
|
@ -0,0 +1,50 @@
|
|||
var gulp = require('gulp');
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var csso = require('gulp-csso');
|
||||
var pump = require('pump');
|
||||
var uglify = require('gulp-uglify');
|
||||
|
||||
|
||||
gulp.task('compress', [
|
||||
'compress:scripts:app',
|
||||
'compress:styles:app',
|
||||
'compress:scripts:vendor',
|
||||
'compress:styles:vendor'
|
||||
]);
|
||||
|
||||
gulp.task('compress:scripts:app', ['scripts:app'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/js/app.js'),
|
||||
concat('app.min.js'),
|
||||
uglify(),
|
||||
gulp.dest('babyblotter/static/babyblotter/js/')
|
||||
], cb);
|
||||
});
|
||||
|
||||
gulp.task('compress:scripts:vendor', ['scripts:vendor'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/js/vendor.js'),
|
||||
concat('vendor.min.js'),
|
||||
uglify(),
|
||||
gulp.dest('babyblotter/static/babyblotter/js/')
|
||||
], cb);
|
||||
});
|
||||
|
||||
gulp.task('compress:styles:app', ['styles:app'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/css/app.css'),
|
||||
concat('app.min.css'),
|
||||
csso(),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
], cb);
|
||||
});
|
||||
|
||||
gulp.task('compress:styles:vendor', ['styles:vendor'], function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static/babyblotter/css/vendor.css'),
|
||||
concat('vendor.min.css'),
|
||||
csso(),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
], cb);
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
const gulp = require('gulp');
|
||||
|
||||
|
||||
gulp.task('default', ['scripts', 'styles', 'compress', 'extras']);
|
|
@ -0,0 +1,11 @@
|
|||
var gulp = require('gulp');
|
||||
|
||||
|
||||
gulp.task('extras', ['extras:fonts']);
|
||||
|
||||
gulp.task('extras:fonts', function(cb) {
|
||||
pump([
|
||||
gulp.src('node_modules/font-awesome/fonts/*'),
|
||||
gulp.dest('babyblotter/static/babyblotter/fonts/')
|
||||
], cb);
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
var gulp = require('gulp');
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var pump = require('pump');
|
||||
|
||||
|
||||
gulp.task('scripts', ['scripts:vendor', 'scripts:app']);
|
||||
|
||||
gulp.task('scripts:vendor', function(cb) {
|
||||
pump([
|
||||
gulp.src([
|
||||
'node_modules/jquery/dist/jquery.js',
|
||||
'node_modules/popper.js/dist/umd/popper.js',
|
||||
'node_modules/bootstrap/dist/js/bootstrap.js',
|
||||
'node_modules/moment/moment.js',
|
||||
'node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js'
|
||||
]),
|
||||
concat('vendor.js'),
|
||||
gulp.dest('babyblotter/static/babyblotter/js/')
|
||||
], cb);
|
||||
});
|
||||
|
||||
gulp.task('scripts:app', function(cb) {
|
||||
pump([
|
||||
gulp.src([
|
||||
'babyblotter/static_site/js/babyblotter.js',
|
||||
'api/static/js/*.js',
|
||||
'core/static/js/*.js',
|
||||
'dashboard/static/js/*.js'
|
||||
]),
|
||||
concat('app.js'),
|
||||
gulp.dest('babyblotter/static/babyblotter/js/')
|
||||
], cb);
|
||||
});
|
|
@ -0,0 +1,30 @@
|
|||
var gulp = require('gulp');
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var pump = require('pump');
|
||||
var sass = require('gulp-sass');
|
||||
var sassGlob = require('gulp-sass-glob');
|
||||
|
||||
|
||||
gulp.task('styles', ['styles:vendor', 'styles:app']);
|
||||
|
||||
gulp.task('scripts:vendor', function(cb) {
|
||||
pump([
|
||||
gulp.src([
|
||||
'node_modules/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.css',
|
||||
'node_modules/font-awesome/css/font-awesome.css'
|
||||
]),
|
||||
concat('vendor.css'),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
], cb);
|
||||
});
|
||||
|
||||
gulp.task('app:styles', function (cb) {
|
||||
pump([
|
||||
gulp.src('babyblotter/static_site/scss/babyblotter.scss'),
|
||||
sassGlob(),
|
||||
sass().on('error', sass.logError),
|
||||
concat('app.css'),
|
||||
gulp.dest('babyblotter/static/babyblotter/css/')
|
||||
], cb);
|
||||
});
|
|
@ -15,6 +15,7 @@
|
|||
"moment": "^2.18.1",
|
||||
"popper.js": "^1.12.3",
|
||||
"pump": "^1.0.2",
|
||||
"require-dir": "^0.3.2",
|
||||
"tempusdominus-bootstrap-4": "^5.0.0-alpha9"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue