forked from material-theme/vsc-material-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·77 lines (58 loc) · 2.06 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
67
68
69
70
71
72
73
74
75
76
77
//
// Sublime Text theme compiler
// Developed with love by Mattia Astorino
//
// Licensed under the MIT License
// https://www.apache.org/licenses/LICENSE-2.0
// ____________________________________________________________________________
// Compiler settings
// #############################################################################
// Compiler settings
var srcPath = './src';
var notifyLogo = './icon.png';
// Modules loader
var gulp = require( 'gulp' ),
path = require( 'path' ),
duration = require( 'gulp-duration' ),
gutil = require( 'gulp-util' ),
clean = require( 'gulp-clean' ),
runSequence = require( 'run-sequence' ),
concat_json = require( "gulp-concat-json" ),
rename = require( 'gulp-rename' ),
concat = require( 'gulp-concat-json2js' ),
wrap = require( 'gulp-wrap' ),
notify = require( 'gulp-notify' );
// Theme builder
// #############################################################################
gulp.task('themeBuilder', function () {
gulp.src('./src/**.json')
.pipe(concat())
.pipe(wrap('[\r\n <%= contents %> \r\n]'))
.pipe(rename({ extname: ".sublime-theme" }) )
.pipe(gulp.dest('./'))
.pipe(notify({
title: "Material Theme",
message: "Theme compiled",
icon: path.join( __dirname, notifyLogo )
}))
.pipe(duration('Building theme'))
})
// cleaner
gulp.task( 'build-clean', function () {
return gulp.src( './test.txt', {read: false} )
.pipe( clean( ) );
});
// Base watcher task
// #############################################################################
gulp.task( 'watch', function() {
gulp.watch( srcPath + '/**/*.js', [ 'builder' ] );
});
// Registered tasks
// #############################################################################
/*gulp.task( 'default', [ 'clean', 'themeBuilder', 'watch' ] );*/
gulp.task( 'default', function( callback ) {
runSequence( 'build-clean', 'themeBuilder', 'watch', callback );
});
gulp.task( 'builder', function( callback ) {
runSequence( 'build-clean', 'themeBuilder', callback );
});