-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
71 lines (63 loc) · 1.75 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var scsslint = require('gulp-scss-lint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var browserSync = require("browser-sync").create();
// configuration
var paths = {
allScripts: [
'developer/js/*.js',
'developer/js/**/*.js'
],
toreload: [
'*.html',
'assets/js/template.js',
'assets/css/theme.css'
],
stylesheet: [
'developer/sass/*.scss',
'developer/sass/**/*.scss'
],
stylesheettocompile: [
'developer/sass/template.scss'
]
};
// define tasks here
gulp.task('lint', function() {
return gulp.src(paths.allScripts)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(uglify())
.pipe(concat('template.js'))
.pipe(gulp.dest('assets/js'));
});
// LINTER SCSS
gulp.task('scss-lint', function() {
return gulp.src(paths.stylesheet)
.pipe(scsslint());
});
// COMPILE CSS from SCSS and minify
gulp.task('sass', function () {
return gulp.src('developer/sass/template.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(rename({ basename: 'theme' }))
.pipe(gulp.dest('assets/css'));
});
gulp.task('browser-sync', function() {
browserSync.init({
proxy: "ads.localhost"
});
});
// watch for changes on js code
gulp.task('watch', function() {
browserSync.init({
proxy: "ads.localhost"
});
gulp.watch(paths.allScripts, ['lint']);
gulp.watch(paths.stylesheet, ['scss-lint']);
gulp.watch(paths.stylesheet, ['sass']);
gulp.watch(paths.toreload).on('change', browserSync.reload);
});