-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (27 loc) · 991 Bytes
/
index.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
var gulp = require('gulp');
var fs = require('fs');
var argv = require('yargs').argv;
var replace = require('gulp-replace');
function BootswatchExtension(config) {
gulp.task('set-theme', function () {
var theme = argv.name;
if (!theme) {
console.log('ERROR: set-theme needs name argument like --name=paper');
} else {
var p = 'node_modules/bootswatch/';
try {
if (fs.statSync(p + theme).isDirectory()) {
if (fs.statSync(p + theme + '/_bootswatch.scss')){
return gulp.src(config.assetsPath.styles + 'bootstrap.scss')
.pipe(replace(/bootswatch\/[^\/]+\//g, 'bootswatch/'+ theme + '/'))
.pipe(gulp.dest(config.assetsPath.styles));
}
}
} catch (err) {
console.log('ERROR: theme "' + theme + '" is not found');
}
}
process.exit(1);
});
}
module.exports = BootswatchExtension;