Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- // npm modules
- const gulp = require('gulp');
- const compass = require('gulp-compass');
- const concat = require('gulp-concat');
- const uglify = require('gulp-uglify');
- const cleanCSS = require('gulp-clean-css');
- const del = require('del');
- //path constants
- const assetsPath = './resources/assets/';
- const bowerPath = assetsPath + 'bower_components';
- const adminPath = bowerPath + '/gentelella';
- const publicPath = './public/';
- const publicCSS = publicPath + 'css/';
- const publicJS = publicPath + 'js/';
- const publicFonts = publicPath + 'fonts/';
- gulp.task('clean', function () {
- return del([
- publicCSS + '/*.css',
- publicJS + '/*.js',
- publicFonts + '/*',
- publicPath + '/vendors/**/*'
- ]);
- });
- gulp.task('base', function () {
- gulp.src([
- bowerPath + '/bootstrap/dist/css/bootstrap.css',
- bowerPath + '/bootstrap/dist/css/bootstrap-theme.css',
- bowerPath + '/font-awesome/css/font-awesome.css'
- ])
- .pipe(concat('base.css'))
- .pipe(cleanCSS({compatibility: '*'}))
- .pipe(gulp.dest(publicCSS));
- gulp.src([
- bowerPath + '/jquery/dist/jquery.js',
- bowerPath + '/bootstrap/dist/js/bootstrap.js'
- ])
- .pipe(concat('base.js'))
- .pipe(uglify())
- .pipe(gulp.dest(publicJS));
- return gulp.src([
- adminPath + '/bootstrap/fonts/*',
- adminPath + '/font-awesome/fonts/*'
- ])
- .pipe(gulp.dest(publicFonts))
- });
- //todo:витягти лише потрібні
- gulp.task('copyVendor', function () {
- return gulp
- .src(adminPath + '/vendors/**/*')
- .pipe(gulp.dest(publicPath + '/vendors'));
- });
- gulp.task('admin', gulp.parallel('copyVendor', function () {
- gulp
- .src([
- adminPath + '/build/css/custom.min.css'
- ])
- .pipe(concat('admin.css'))
- .pipe(gulp.dest(publicCSS));
- return gulp
- .src([
- adminPath + '/build/js/custom.min.js'
- ])
- .pipe(concat('admin.js'))
- .pipe(gulp.dest(publicJS));
- }));
- gulp.task('frontend', function () {
- gulp.src([
- assetsPath+'js/common.js'
- ])
- .pipe(concat('common.js'))
- .pipe(uglify())
- .pipe(gulp.dest(publicJS));
- return gulp
- .src(assetsPath + '/sass/styles.scss')
- .pipe(compass({
- config_file: assetsPath + '/sass/config.rb',
- css: publicCSS,
- sass: assetsPath + '/sass',
- image: publicPath + '/img',
- logging: true
- }))
- .pipe(gulp.dest(publicCSS));
- });
- gulp.task('default', gulp.series('clean', gulp.parallel('base', 'admin', 'frontend')));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement