forked from mityalebedev/The-Shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (45 loc) · 1.36 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
const gulp = require('gulp');
const { watch } = require('gulp');
// gulp plugins and utils
const sourcemaps = require('gulp-sourcemaps');
const zip = require('gulp-zip');
const sass = require('gulp-sass');
const browserSync = require("browser-sync").create();
sass.compiler = require('node-sass');
// css plugins
const autoprefixer = require('gulp-autoprefixer');
function reload() {
browserSync.reload();
}
function styles() {
return gulp.src('assets/scss/screen.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(autoprefixer({browsers: ['last 2 versions']}))
.pipe(gulp.dest('assets/css/'))
.pipe(browserSync.stream());
}
function release() {
var targetDir = 'dist/';
var themeName = require('./package.json').name;
var filename = themeName + '.zip';
return gulp.src([
'**',
'!node_modules', '!node_modules/**',
'!dist', '!dist/**',
'!assets/scss', '!assets/scss/**'
])
.pipe(zip(filename))
.pipe(gulp.dest(targetDir));
}
function watchFiles() {
browserSync.init({
proxy: "localhost:2368"
});
watch(['assets/scss/**/*.scss'], styles);
watch(['**/*.hbs'], styles);
}
exports.styles = styles;
exports.release = release;
exports.watch = watchFiles;