forked from django-cms/django-filer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·63 lines (55 loc) · 1.87 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
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
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('lint', function () {
return gulp.src(PROJECT_PATTERNS.lint)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(stylish))
.pipe(jscs('.jscsrc'))
.on('error', function (error) {
gutil.log('\n' + error.message);
if (process.env.CI) {
process.exit(1);
}
});
});
gulp.task('lint:watch', function () {
gulp.watch(PROJECT_PATTERNS.lint, ['lint']);
});
gulp.task('compile', ['scss']);
gulp.task('watch', ['scss:watch', 'lint:watch']);
gulp.task('ci', ['lint']);