forked from genagl/shmapper
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
66 lines (55 loc) · 1.28 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
var path = require('path');
var name = path.basename(__dirname);
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
var zip = require('gulp-zip');
var cssInput = './src/sass/**/*.scss';
var cssOutput = './assets/css/';
var sassOptions = {
errLogToConsole: true,
outputStyle: 'expanded',
indentType: 'tab',
indentWidth: 1,
charset: false
};
var jsInput = './src/jsx/**/*.jsx';
var jsOutput = './assets/js/';
gulp.task( 'sass', function () {
return gulp
// Find all `.scss` files from the `stylesheets/` folder
.src(cssInput)
// Run Sass on those files
.pipe(sass(sassOptions).on('error', sass.logError))
// Write the resulting CSS in the output folder
.pipe(gulp.dest(cssOutput));
});
// Watchers
gulp.task( 'watch', () => {
gulp.watch(
[ cssInput ],
gulp.series([ 'sass' ] )
);
});
// Default
gulp.task( 'default', gulp.series( 'sass', 'watch' ) );
// Archive
gulp.task('zip', function(e){
const distFiles = [
'**',
'!src/**',
'!node_modules/**',
'!.gitignore',
'!gulpfile.js',
'!CHANGELOG.md',
'!package.json',
'!package-lock.json',
'!composer.json',
'!README.md',
'!phpcs.xml',
'!security.xml',
'!**.zip'
];
return gulp.src( distFiles, { base: '../' } )
.pipe( zip( name + '.zip' ) )
.pipe( gulp.dest( './' ) )
});