-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
36 lines (31 loc) · 905 Bytes
/
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
//Gulp Sass plugins
var gulp = require("gulp"),
gutil = require('gulp-util'),
browserSync = require('browser-sync').create(),
rename = require('gulp-rename')
argv = require('yargs').argv;
//generates a new template
gulp.task('generate-template', function() {
argv.n = '' ? 'untitled-element' : argv.n;
argv.base = !argv.base ? 'template' : argv.base;
//rename files
gulp.src(['./app/' + argv.base + '/**/*'])
.pipe(rename(function(path) {
if (argv.e === path.extname) {
path.basename = argv.n;
} else if (argv.e === '*') {
path.basename = argv.n;
}
}))
.pipe(gulp.dest('./app/elements/' + argv.n));
})
//serve
gulp.task('serve', function() {
browserSync.init({
server: "./app/"
});
gulp.watch("./app/**/*.html").on('change', browserSync.reload);
});
// gist
gulp.task("default", ["serve"]);
gulp.task('gt', ["generate-template"])