mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge pull request #5001 from hanakin/ticket/15403
[ticket/15403] Add useful front-end build tools
This commit is contained in:
commit
c1fb27a68a
2 changed files with 89 additions and 0 deletions
71
gulpfile.js
Normal file
71
gulpfile.js
Normal file
|
@ -0,0 +1,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('gulp-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()
|
||||||
|
])
|
||||||
|
)
|
||||||
|
.pipe(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']);
|
18
package.json
18
package.json
|
@ -13,6 +13,10 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/phpbb/phpbb.git"
|
"url": "git+https://github.com/phpbb/phpbb.git"
|
||||||
},
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions"
|
||||||
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"phpBB",
|
"phpBB",
|
||||||
"phpbb",
|
"phpbb",
|
||||||
|
@ -30,5 +34,19 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"stylelint": "8.0.0",
|
"stylelint": "8.0.0",
|
||||||
"stylelint-order": "0.3.0"
|
"stylelint-order": "0.3.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"del": "^3.0.0",
|
||||||
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-autoprefixer": "^4.0.0",
|
||||||
|
"gulp-cssnano": "^2.1.2",
|
||||||
|
"gulp-postcss": "^7.0.0",
|
||||||
|
"gulp-rename": "^1.2.2",
|
||||||
|
"gulp-sass": "^3.1.0",
|
||||||
|
"gulp-sourcemaps": "^2.6.1",
|
||||||
|
"gulp-stylefmt": "^1.1.0",
|
||||||
|
"postcss-import": "^11.0.0",
|
||||||
|
"postcss-pxtorem": "^4.0.1",
|
||||||
|
"postcss-sorting": "^3.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue