aboutsummaryrefslogtreecommitdiff
blob: b2e008912ab7b8e7cfe249d6915207c5e5757adf (plain)
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
'use strict';

const del = require('del');
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const cssnano = require('cssnano');
const postcss = require('gulp-postcss');
const stylefmt = require('gulp-stylefmt');
const sorting = require('postcss-sorting');
const atimport = require('postcss-import');
const torem = require('postcss-pxtorem');
const sortOrder = require('./.postcss-sorting.json');
const pkg = require('./package.json');

// Config
const build = {
	css: './phpBB/styles/prosilver/theme/',
};

const AUTOPREFIXER_BROWSERS = [
	'> 1%',
	'last 2 versions'
];

gulp.task('css', () => {
	const css = gulp
	.src(build.css + '*.css')
	.pipe(autoprefixer(AUTOPREFIXER_BROWSERS))
	.pipe(
		postcss([
			sorting(sortOrder)
		])
	)
	.pipe(stylefmt())
	.pipe(gulp.dest(build.css));

	return css;
});

gulp.task('clean', () => {
	del(['dist']);
});

gulp.task('minify', () => {
	const css = gulp
	.src(build.css + '/bidi.css')
	.pipe(sourcemaps.init())
	.pipe(
		postcss([
			atimport(),
			cssnano()
		])
	)
	.pipe(rename({
		suffix: '.min',
		extname: '.css'
	}))
	.pipe(sourcemaps.write('./'))
	.pipe(gulp.dest(build.css));

	return css;
});

gulp.task('watch', () => {
	gulp.watch('phpBB/styles/prosilver/theme/*.css', ['css']);
});

gulp.task('default', ['css', 'watch']);