Skip to content

Commit 6f21810

Browse files
committed
reverted stylelint gulpfile
1 parent 29bc987 commit 6f21810

5 files changed

Lines changed: 45 additions & 146 deletions

File tree

gulpfile.js

Lines changed: 41 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -15,82 +15,56 @@ var gulp = require('gulp'),
1515
plumber = require('gulp-plumber'),
1616
deploy = require('gulp-gh-pages'),
1717
notify = require('gulp-notify'),
18-
twig = require('gulp-twig'),
19-
gulpStylelint = require('gulp-stylelint'),
20-
runSequence = require('run-sequence'),
21-
del = require('del');
18+
sassLint = require('gulp-sass-lint'),
19+
twig = require('gulp-twig');
2220

23-
var is_prod = false;
24-
25-
var paths = {
26-
libscss: 'source/scss/**/*.scss',
27-
sitescss: 'site/scss/**/*.scss',
28-
sitetwig: 'site/**/*.twig',
29-
siteimg: 'site/img',
30-
testimg: 'site/test/ref',
31-
testcss: 'site/test/css',
32-
filtersjson: 'site/filters.json',
33-
dev: '.dev/'
34-
}
35-
var compiledPaths = {
36-
libcss: 'source/css/',
37-
sitecss: 'site/css/'
38-
}
3921

4022
gulp.task('lib-scss', function() {
41-
var dest = paths.dev + compiledPaths.libcss;
42-
if (is_prod) {
43-
dest = compiledPaths.libcss;
44-
}
45-
var onError = function(err) {
46-
notify.onError({
47-
title: "Gulp",
48-
subtitle: "Failure!",
49-
message: "Error: <%= error.message %>",
50-
sound: "Beep"
51-
})(err);
52-
this.emit('end');
23+
var onError = function(err) {
24+
notify.onError({
25+
title: "Gulp",
26+
subtitle: "Failure!",
27+
message: "Error: <%= error.message %>",
28+
sound: "Beep"
29+
})(err);
30+
this.emit('end');
5331
};
5432

55-
return gulp.src(paths.libscss)
33+
return gulp.src('source/scss/**/*.scss')
5634
.pipe(plumber({errorHandler: onError}))
5735
.pipe(sass())
5836
.pipe(size({ gzip: true, showFiles: true }))
5937
.pipe(prefix())
60-
.pipe(gulp.dest(dest))
38+
.pipe(gulp.dest('source/css'))
6139
.pipe(cssmin())
6240
.pipe(size({ gzip: true, showFiles: true }))
6341
.pipe(rename({ suffix: '.min' }))
64-
.pipe(gulp.dest(dest))
42+
.pipe(gulp.dest('source/css'))
43+
.pipe(gulp.dest('site/css'))
6544
.pipe(reload({stream:true}));
6645
});
6746

6847
gulp.task('site-scss', function() {
69-
var dest = paths.dev + compiledPaths.sitecss;
70-
if (is_prod) {
71-
dest = compiledPaths.sitecss;
72-
}
73-
var onError = function(err) {
74-
notify.onError({
75-
title: "Gulp",
76-
subtitle: "Failure!",
77-
message: "Error: <%= error.message %>",
78-
sound: "Beep"
79-
})(err);
80-
this.emit('end');
48+
var onError = function(err) {
49+
notify.onError({
50+
title: "Gulp",
51+
subtitle: "Failure!",
52+
message: "Error: <%= error.message %>",
53+
sound: "Beep"
54+
})(err);
55+
this.emit('end');
8156
};
8257

83-
return gulp.src(paths.sitescss)
58+
return gulp.src('site/scss/**/*.scss')
8459
.pipe(plumber({errorHandler: onError}))
8560
.pipe(sass())
8661
.pipe(size({ gzip: true, showFiles: true }))
8762
.pipe(prefix())
88-
.pipe(gulp.dest(dest))
89-
.pipe(reload({stream:true}))
63+
.pipe(gulp.dest('site/css'))
9064
.pipe(cssmin())
9165
.pipe(size({ gzip: true, showFiles: true }))
9266
.pipe(rename({ suffix: '.min' }))
93-
.pipe(gulp.dest(dest))
67+
.pipe(gulp.dest('site/css'))
9468
.pipe(reload({stream:true}));
9569
});
9670

@@ -107,111 +81,34 @@ gulp.task('deploy', function () {
10781
.pipe(deploy());
10882
});
10983

110-
gulp.task('lint-css', function lintCssTask() {
111-
var gulpStylelint = require('gulp-stylelint');
112-
var myStylelintFormatter = require('my-stylelint-formatter');
113-
114-
return gulp
115-
.src('src/**/*.css')
116-
.pipe(gulpStylelint({
117-
failAfterError: true,
118-
reportOutputDir: 'reports/lint',
119-
reporters: [
120-
{formatter: 'verbose', console: true},
121-
{formatter: 'json', save: 'report.json'},
122-
{formatter: myStylelintFormatter, save: 'my-custom-report.txt'}
123-
],
124-
debug: true
125-
}));
126-
});
127-
128-
gulp.task('jshint', function() {
129-
gulp.src('js/*.js')
130-
.pipe(jshint())
131-
.pipe(jshint.reporter('default'));
84+
gulp.task('sass-lint', function () {
85+
gulp.src('scss/**/*.scss')
86+
.pipe(sassLint())
87+
.pipe(sassLint.format())
88+
.pipe(sassLint.failOnError());
13289
});
13390

13491
gulp.task('twig', function () {
135-
var dest = paths.dev;
136-
if (is_prod) {
137-
dest = './';
138-
}
139-
gulp.src([paths.sitetwig, "!site/twig/template.twig"], {base: './'})
92+
gulp.src(['site/**/*.twig', "!site/twig/template.twig"], {base: './'})
14093
.pipe(twig({
14194
data: require('./site/filters.json')
14295
}))
143-
.pipe(gulp.dest(dest));
96+
.pipe(gulp.dest('./'));
14497
});
14598

146-
function copytask(src, dest) {
147-
return function() {
148-
return gulp.src(src)
149-
.pipe(gulp.dest(dest));
150-
}
151-
}
15299

153-
gulp.task('copy-site-img', copytask(
154-
paths.siteimg + '/**/*',
155-
paths.dev + paths.siteimg
156-
));
157-
gulp.task('copy-test-img', copytask(
158-
paths.testimg + '/**/*',
159-
paths.dev + paths.testimg
160-
));
161-
gulp.task('copy-test-css', copytask(
162-
paths.testcss + '/**/*',
163-
paths.dev + paths.testcss
164-
));
165-
gulp.task('copy-files', ['copy-site-img', 'copy-test-img', 'copy-test-css']);
166-
167-
gulp.task('dev-build', function(cb) {
168-
is_prod = false;
169-
runSequence(
170-
'cleandev',
171-
'copy-files',
172-
'site-scss',
173-
'lib-scss',
174-
'twig',
175-
cb
176-
);
177-
});
178-
gulp.task('watch', ['dev-build'], function() {
179-
browserSync({
180-
server: {
181-
baseDir: paths.dev + 'site'
182-
}
183-
});
184-
gulp.watch(paths.libscss, ['lib-scss', 'site-scss', 'sass-lint']);
185-
gulp.watch(paths.sitescss, ['site-scss', 'sass-lint']);
100+
gulp.task('watch', function() {
101+
gulp.watch('source/scss/**/*.scss', ['lib-scss', 'site-scss', 'sass-lint']);
102+
gulp.watch('site/scss/**/*.scss', ['site-scss', 'sass-lint']);
186103
gulp.watch('source/scss/**/*.html', ['minify-html']);
187-
gulp.watch(paths.sitetwig, ['twig']);
104+
gulp.watch('site/**/*.twig', ['twig']);
188105
});
189106

190-
gulp.task('cleandev', function() {
191-
return del([paths.dev]);
192-
});
193107

194-
gulp.task('build', function(cb) {
195-
is_prod = true;
196-
runSequence(
197-
'site-scss',
198-
'lib-scss',
199-
'twig',
200-
cb
201-
);
202-
});
203-
204-
gulp.task('server', function() {
205-
browserSync({
206-
server: {
207-
baseDir: 'site'
208-
}
209-
});
210-
});
211-
212-
gulp.task('deploy', function () {
213-
return gulp.src('site/**/*')
214-
.pipe(deploy());
108+
gulp.task('jshint', function() {
109+
gulp.src('js/*.js')
110+
.pipe(jshint())
111+
.pipe(jshint.reporter('default'));
215112
});
216113

217-
gulp.task('default', ['watch']);
114+
gulp.task('default', ['browser-sync', 'twig', 'lib-scss', 'site-scss', 'watch']);

0 commit comments

Comments
 (0)