forked from FatherShawn/dev_automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
105 lines (97 loc) · 2.53 KB
/
gulpfile.js
File metadata and controls
105 lines (97 loc) · 2.53 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const gulp = require('gulp');
const markdown = require('gulp-markdown');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const sassGlob = require('gulp-sass-glob');
const sassLint = require('gulp-sass-lint');
var paths = {
scripts: [
'js/**/*.js',
'!js/**/*.min.js'
],
sass: {
main: 'style/scss/styles.scss',
watch: 'style/scss/**/*'
},
css: {
root: 'style/css'
},
clean: [
'style/css/styles.css',
'style/css/**/*.css.map',
'js/**/*.min.js'
]
};
gulp.task('build', ['generate', 'sass', 'compress']);
gulp.task('generate', function () {
'use strict';
gulp.src('dev_automation.md')
.pipe(markdown())
.pipe(rename('slides.html'))
.pipe(gulp.dest('./dist'))
});
gulp.task('clean', function () {
'use strict';
return del(paths.clean);
});
gulp.task('lint', function () {
'use strict';
return gulp.src(paths.sass.watch)
.pipe(sassLint({
files: {
ignore: [
'style/scss/normalize/**',
'style/scss/base/_fonts.scss'
]
},
rules: {
'no-ids': 0,
'nesting-depth': [1, {'max-depth': 4}],
'no-qualifying-elements': [1, {'allow-element-with-class': true}],
'force-element-nesting': 0,
'force-pseudo-nesting': 0,
'property-sort-order': 0,
'no-vendor-prefixes': 0,
'mixins-before-declarations': [1, {exclude: ['media']}],
'placeholder-in-extend': 0,
'single-line-per-selector': 0,
'no-misspelled-properties': [1, {'extra-properties': ['-webkit-overflow-scrolling']}],
'class-name-format': 0
}
}))
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
});
gulp.task('compress', function () {
'use strict';
return gulp.src(paths.scripts)
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('js/dist'));
});
gulp.task('sass', function () {
'use strict';
return gulp.src(paths.sass.main)
.pipe(sassGlob())
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: [
'node_modules/support-for/sass'
]
}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions', 'IE >= 11']
}))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest(paths.css.root))
.pipe(livereload());
});
gulp.task('sourcemaps', function () {
'use strict';
return gulp.src(paths.sass.main)
.pipe(sassGlob())
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.css.root));
});