-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (53 loc) · 1.75 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var autoprefixer = require( 'autoprefixer' );
var rename = require( 'gulp-rename' );
var replace = require( 'gulp-replace' );
var uglify = require( 'gulp-uglify' );
var rtlcss = require( 'gulp-rtlcss' );
var sass = require( 'gulp-sass' );
var postcss = require( 'gulp-postcss' );
var sorting = require( 'postcss-sorting' );
// Minify JS
gulp.task( 'minifyjs', function() {
return gulp.src( ['assets/js/custom-font-control.js', 'assets/js/customize-preview.js', 'assets/js/scroll-to-top.js'] )
.pipe( uglify() )
.pipe( rename( {
suffix: '.min'
} ) )
.pipe( gulp.dest('assets/js') );
});
// Clean up CSS
gulp.task( 'cleancss', function() {
return gulp.src( ['assets/css/*.css'], { base: './' } )
.pipe( postcss( [ autoprefixer() ] ) )
.pipe( postcss( [ sorting( { 'preserve-empty-lines-between-children-rules': true } ) ] ) )
.pipe( gulp.dest( './' ) );
});
// RTL CSS
gulp.task( 'rtlcss', function () {
return gulp.src( 'assets/css/palm-beach-pro.css' )
.pipe( rtlcss() )
.pipe( rename( {
suffix: '-rtl'
} ) )
.pipe( gulp.dest( 'assets/css' ) );
});
// Sass Bundler
gulp.task( 'sass', function() {
return gulp.src( 'sass/style.scss' )
.pipe( sass( { outputStyle: 'expanded' } ).on( 'error', sass.logError ) )
.pipe( rename( 'assets/css/palm-beach-pro.css' ) )
.pipe( postcss( [ sorting() ] ) )
.pipe( replace( ' ', ' ' ) )
.pipe( replace( '}\n ', '}\n\n ' ) )
.pipe( replace( '}\n\n }', '}\n }' ) )
.pipe( replace( '*/\n/*', '*/\n\n/*' ) )
.pipe( replace( ';\n /*', '; /*' ) )
.pipe( gulp.dest( './' ) )
});
// Sass Watch
gulp.task('sass:watch', function () {
gulp.watch( 'sass/**/*.scss', gulp.series('sass'));
});