forked from anchorcms/anchor-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (60 loc) · 1.31 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
60
61
62
63
64
65
66
const gulp = require( 'gulp' );
const plumber = require( 'gulp-plumber' );
const sass = require( 'gulp-sass' );
const postcss = require( 'gulp-postcss' );
const sourcemaps = require( 'gulp-sourcemaps' );
const autoprefixer = require( 'autoprefixer' );
const rename = require( 'gulp-rename' );
const cleanCSS = require( 'gulp-clean-css' );
const paths = {
sass: "./anchor/views/assets/scss",
css: "./anchor/views/assets/css"
};
/**
* Compiles .scss to .css files.
*
* Run: gulp sass
*/
gulp.task( 'sass', function() {
return gulp
.src( paths.sass + '/admin.scss' )
.pipe(
plumber( {
errorHandler( err ) {
console.log( err );
this.emit( 'end' );
},
} )
)
.pipe( sass( { errLogToConsole: true } ) )
.pipe( postcss( [ autoprefixer() ] ) )
.pipe(
cleanCSS( {
compatibility: '*',
} )
)
.pipe(
plumber( {
errorHandler( err ) {
console.log( err );
this.emit( 'end' );
},
} )
)
.pipe( rename( { suffix: '.min' } ) )
.pipe( gulp.dest( paths.css ) );
} );
/**
* Compiles .scss to .css minifies css files.
*
* Run: gulp styles
*/
gulp.task( 'styles', function( callback ) {
gulp.series( 'sass' )( callback );
} );
gulp.task( 'default', () => {
gulp.watch(
[ paths.sass + '/**/*.scss', paths.sass + '/*.scss' ],
gulp.series( 'styles' )
);
})