-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
executable file
·37 lines (32 loc) · 948 Bytes
/
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
var gulp = require('gulp')
var sass = require('gulp-sass')
var reactNativeStyle = require('gulp-react-native-stylesheet-css')
var watch = require('gulp-watch')
var eslint = require('gulp-eslint')
var gulpIf = require('gulp-if')
var paths = {
style: './src/**/**/styles.sass',
styleDest: './src/',
styleDestJs: './src/**/**/styles.js',
src: './src/**/*.js',
srcDest: './src/',
}
function isFixed(file) {
return file.eslint != null && file.eslint.fixed
}
gulp.task('style', function() {
return watch(paths.style, {ignoreInitial: false})
.pipe(sass())
.pipe(reactNativeStyle())
.pipe(eslint({ fix: true }))
.pipe(eslint.format())
.pipe(gulp.dest(paths.styleDest))
})
gulp.task('default', ['style'], function() {
})
gulp.task('lint', function() {
return watch(paths.src, {ignoreInitial: false})
.pipe(eslint({ fix: true }))
.pipe(eslint.format())
.pipe(gulpIf(isFixed, gulp.dest(paths.srcDest)))
})