forked from django-cms/django-filer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·69 lines (59 loc) · 2.01 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var stylish = require('jshint-stylish');
var PROJECT_ROOT = __dirname;
var PROJECT_PATH = {
'scss': PROJECT_ROOT + '/filer/private/sass/',
'css': PROJECT_ROOT + '/filer/static/filer/css/',
'js': PROJECT_ROOT + '/filer/static/filer/js/'
};
var PROJECT_PATTERNS = {
'scss': PROJECT_PATH.scss + '**/*.scss',
'lint': [
PROJECT_PATH.js + '**/*.js',
PROJECT_ROOT + '/gulpfile.js'
]
};
// #############################################################################
// SCSS
gulp.task('scss', function () {
gulp.src(PROJECT_PATTERNS.scss)
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(sourcemaps.write('/maps'))
.pipe(gulp.dest(PROJECT_PATH.css));
});
gulp.task('scss:watch', function () {
gulp.watch(PROJECT_PATTERNS.scss, ['scss']);
});
// #############################################################################
// LINTING
gulp.task('jscs:fix', function () {
return gulp.src(PROJECT_PATH.js + '**/*.js')
.pipe(jscs({fix: true}))
.pipe(gulp.dest(PROJECT_PATH.js));
});
gulp.task('jscs', function () {
return gulp.src(PROJECT_PATTERNS.lint)
.pipe(jscs())
.pipe(jscs.reporter())
.pipe(jscs.reporter('fail'));
});
gulp.task('lint', function () {
return gulp.src(PROJECT_PATTERNS.lint)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'));
});
gulp.task('lint:watch', function () {
gulp.watch(PROJECT_PATTERNS.lint, ['lint', 'jscs']);
});
gulp.task('compile', ['scss']);
gulp.task('watch', ['scss:watch', 'lint:watch']);
gulp.task('ci', ['lint', 'jscs']);