forked from elpargo/startupweekenddo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (58 loc) · 1.85 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var notify = require('gulp-notify');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var livereload = require('gulp-livereload');
var scsslint = require('gulp-scss-lint');
var autoprefixer = require('gulp-autoprefixer');
config = {
sassPath: 'static/sass',
jsPath: 'static/js',
bowerDir: 'static/components',
distPath: 'static/dist/'
}
gulp.task('styles', function() {
return gulp.src(config.sassPath + '/**/*.scss')
.pipe(sass({
includePaths: [
config.bowerDir + '/bootstrap-sass/assets/stylesheets',
config.bowerDir + '/font-awesome/scss',
]
})
.on('error', notify.onError(function (error) {
return "Error: " + error.message;
})))
.pipe(autoprefixer({
browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
}))
.pipe(gulp.dest(config.distPath + 'css/'))
.pipe(livereload());
});
gulp.task('scss-lint', function() {
return gulp.src(config.sassPath + '/**/*.scss')
.pipe(scsslint({
'config': '.scss-lint.yml',
'endless': 'true'
}));
});
gulp.task('scripts', function() {
return gulp.src(config.jsPath + '/**/*.js')
.pipe(concat('scripts.js'))
.pipe(gulp.dest(config.distPath + 'js/'))
.pipe(rename('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest(config.distPath + 'js/'));
});
// Compile Font Awesome
gulp.task('icons', function() {
return gulp.src(config.bowerDir + '/font-awesome/fonts/**.**')
.pipe(gulp.dest(config.distPath + 'fonts/'));
});
// Watch task
gulp.task('watch',function() {
livereload.listen();
gulp.watch(config.sassPath + '/**/*.scss', ['styles', 'scss-lint']);
});
gulp.task('default', ['styles', 'scripts', 'icons']);