forked from skilld-labs/zen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (33 loc) · 1.04 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
/**
* @file
* Script to clone & rename starterkit.
*/
'use strict';
var gulp = require('gulp'),
replace = require('gulp-replace'),
rename = require('gulp-regex-rename'),
argv = require('yargs').argv,
sourceFiles = [ 'STARTERKIT/*', 'STARTERKIT/.*', 'STARTERKIT/*/**'],
del = require('del'),
theme_name = (argv.theme_name === undefined) ? false : argv.theme_name,
destination = '../' + theme_name;
if (!theme_name) {
return console.log('You shoud specify theme name `gulp --theme_name new_theme_name`');
}
gulp.task('default', ['clean'], function () {
if (!theme_name) {
return console.log('You shoud specify theme name `gulp --theme_name new_theme_name`');
}
return gulp
.src(sourceFiles)
.pipe(replace('STARTERKIT', theme_name))
.pipe(rename(/STARTERKIT/, theme_name))
.pipe(gulp.dest(destination));
});
// Clean files.
gulp.task('clean', function () {
if (!theme_name) {
return console.log('You shoud specify theme name `gulp --theme_name new_theme_name`');
}
return del([ destination + '/*' ], {force: true});
});