mirror of
https://github.com/yuzu-emu/yuzu-emu.github.io.git
synced 2025-06-10 15:44:21 +00:00
Merge pull request #183 from liushuyu/hugo
Generate Thumbnails for Images
This commit is contained in:
commit
724d1f9255
|
@ -2,7 +2,7 @@
|
|||
|
||||
language: node_js
|
||||
node_js:
|
||||
- "11"
|
||||
- "lts/erbium"
|
||||
cache: yarn
|
||||
|
||||
install:
|
||||
|
|
133
gulpfile.js
133
gulpfile.js
|
@ -8,79 +8,86 @@ const sass = require('gulp-sass');
|
|||
const postcss = require('gulp-postcss');
|
||||
const cssnano = require('cssnano');
|
||||
const concat = require('gulp-concat');
|
||||
const rename = require('gulp-rename');
|
||||
const imageResize = require('gulp-image-resize');
|
||||
const parallel = require('concurrent-transform');
|
||||
const os = require('os');
|
||||
const browserSync = require('browser-sync').create();
|
||||
|
||||
// Gulp Run Tasks
|
||||
gulp.task('scripts:compatdb', callback => {
|
||||
exec(`cd ./scripts/shared-hugo-scripts/compatdb/ && yarn install && node app.js`, (err, stdout, stderr) => {
|
||||
callback(err);
|
||||
});
|
||||
exec('cd ./scripts/shared-hugo-scripts/compatdb/ && yarn install && node app.js', (err, stdout, stderr) => {
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('scripts:twitter', callback => {
|
||||
exec(`cd ./scripts/shared-hugo-scripts/twitter/ && yarn install && node app.js`, (err, stdout, stderr) => {
|
||||
callback(err);
|
||||
});
|
||||
exec('cd ./scripts/shared-hugo-scripts/twitter/ && yarn install && node app.js', (err, stdout, stderr) => {
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('scripts:wiki', callback => {
|
||||
exec(`cd ./scripts/shared-hugo-scripts/wiki/ && yarn install && node app.js`, (err, stdout, stderr) => {
|
||||
callback(err);
|
||||
});
|
||||
exec('cd ./scripts/shared-hugo-scripts/wiki/ && yarn install && node app.js', (err, stdout, stderr) => {
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('assets:images', () => {
|
||||
const baseImages = gulp.src(`build/images/*`, {base: './'})
|
||||
.pipe(gulp.dest('./'));
|
||||
const jumbotronImages = gulp.src(`build/images/jumbotron/*`, {base: './'})
|
||||
.pipe(imageResize({width: 426, height: 240, crop: true}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const bannerImages = gulp.src(`build/images/banners/*`, {base: './'})
|
||||
.pipe(imageResize({width: 824, height: 306, crop: false}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const boxartImages = gulp.src(`build/images/game/boxart/*`, {base: './'})
|
||||
.pipe(imageResize({width: 328, height: 300, crop: true}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const iconImages = gulp.src(`build/images/game/icons/*`, {base: './'})
|
||||
.pipe(imageResize({width: 48, height: 48, crop: true}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const screenshotImages = gulp.src(`build/images/screenshots/*`)
|
||||
.pipe(imageResize({width: 640, height: 360, crop: false}))
|
||||
.pipe(gulp.dest(`build/images/screenshots/thumbs`));
|
||||
|
||||
return merge(baseImages, jumbotronImages, bannerImages, boxartImages, iconImages, screenshotImages);
|
||||
const baseImages = gulp.src('build/images/*', {base: './'})
|
||||
.pipe(gulp.dest('./'));
|
||||
const jumbotronImages = gulp.src('build/images/jumbotron/*', {base: './'})
|
||||
.pipe(imageResize({width: 426, height: 240, crop: true}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const bannerImages = gulp.src('build/images/banners/*', {base: './'})
|
||||
.pipe(imageResize({width: 824, height: 306, crop: false}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const boxartImages = gulp.src('build/images/game/boxart/*', {base: './'})
|
||||
.pipe(imageResize({width: 328, height: 300, crop: true}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const iconImages = gulp.src('build/images/game/icons/*', {base: './'})
|
||||
.pipe(imageResize({width: 48, height: 48, crop: true}))
|
||||
.pipe(gulp.dest('./'));
|
||||
const screenshotImages = gulp.src('build/images/screenshots/*')
|
||||
.pipe(imageResize({width: 640, height: 360, crop: false}))
|
||||
.pipe(gulp.dest('build/images/screenshots/thumbs'));
|
||||
const postImages = gulp.src('build/entry/*/*.png')
|
||||
.pipe(parallel(imageResize({quality: 0.8, format: 'jpg', percentage: 80})), os.cpus().length)
|
||||
.pipe(rename({extname: '.png.jpg'}))
|
||||
.pipe(gulp.dest('build/entry/'));
|
||||
|
||||
return merge(baseImages, jumbotronImages, bannerImages, boxartImages, iconImages, screenshotImages, postImages);
|
||||
});
|
||||
|
||||
gulp.task('assets:js', () => {
|
||||
return gulp.src(['src/js/**/*.js'])
|
||||
.pipe(concat('script.js'))
|
||||
.pipe(gulp.dest('build/js'));
|
||||
return gulp.src(['src/js/**/*.js'])
|
||||
.pipe(concat('script.js'))
|
||||
.pipe(gulp.dest('build/js'));
|
||||
});
|
||||
|
||||
gulp.task('assets:scss', () => {
|
||||
const postCssOptions = [cssnano];
|
||||
return gulp.src('src/scss/style.scss')
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(postcss(postCssOptions))
|
||||
.pipe(gulp.dest('build/css'))
|
||||
.pipe(browserSync.stream());
|
||||
const postCssOptions = [cssnano];
|
||||
return gulp.src('src/scss/style.scss')
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(postcss(postCssOptions))
|
||||
.pipe(gulp.dest('build/css'))
|
||||
.pipe(browserSync.stream());
|
||||
});
|
||||
|
||||
gulp.task('hugo', callback => {
|
||||
exec('hugo -s ./site/ -d ../build/ -v', (err, stdout, stderr) => {
|
||||
console.log(stdout);
|
||||
callback(err);
|
||||
});
|
||||
exec('hugo -s ./site/ -d ../build/ -v', (err, stdout, stderr) => {
|
||||
console.log(stdout);
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('final:serve', (done) => {
|
||||
browserSync.init({
|
||||
open: false,
|
||||
server: {
|
||||
baseDir: 'build'
|
||||
}
|
||||
});
|
||||
browserSync.init({
|
||||
open: false,
|
||||
server: {
|
||||
baseDir: 'build'
|
||||
}
|
||||
});
|
||||
|
||||
gulp.watch('src/js/**/*', gulp.series('assets:js'));
|
||||
gulp.watch('src/scss/**/*', gulp.series('assets:scss'));
|
||||
|
@ -88,34 +95,34 @@ gulp.task('final:serve', (done) => {
|
|||
gulp.watch('site/**/*.md', gulp.series('hugo'));
|
||||
|
||||
gulp.watch('build/**/*.html').on('change', function(x) {
|
||||
browserSync.reload(x);
|
||||
browserSync.reload(x);
|
||||
});
|
||||
|
||||
done()
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task('final:publish', (done) => {
|
||||
fs.writeFileSync(`build/CNAME`, `${cname}`);
|
||||
fs.writeFileSync(`build/robots.txt`, `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`);
|
||||
done()
|
||||
fs.writeFileSync('build/CNAME', `${cname}`);
|
||||
fs.writeFileSync('build/robots.txt', `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`);
|
||||
done();
|
||||
});
|
||||
|
||||
const cname = 'yuzu-emu.org';
|
||||
let finalCommand = null;
|
||||
|
||||
if (util.env.production) {
|
||||
process.env.HUGO_ENV = 'PRD';
|
||||
process.env.HUGO_BASEURL = `https://${cname}`
|
||||
finalCommand = 'final:publish';
|
||||
process.env.HUGO_ENV = 'PRD';
|
||||
process.env.HUGO_BASEURL = `https://${cname}`;
|
||||
finalCommand = 'final:publish';
|
||||
} else {
|
||||
process.env.HUGO_ENV = 'DEV';
|
||||
process.env.HUGO_BASEURL = 'http://localhost:3000'
|
||||
finalCommand = 'final:serve';
|
||||
process.env.HUGO_ENV = 'DEV';
|
||||
process.env.HUGO_BASEURL = 'http://localhost:3000';
|
||||
finalCommand = 'final:serve';
|
||||
}
|
||||
|
||||
util.log(`process.env.HUGO_ENV = '${process.env.HUGO_ENV}'`)
|
||||
util.log(`process.env.HUGO_BASEURL = '${process.env.HUGO_BASEURL}'`)
|
||||
util.log(`process.env.HUGO_ENV = '${process.env.HUGO_ENV}'`);
|
||||
util.log(`process.env.HUGO_BASEURL = '${process.env.HUGO_BASEURL}'`);
|
||||
|
||||
gulp.task('default', gulp.series(gulp.parallel('assets:js', 'assets:scss'), 'hugo', 'assets:images', finalCommand))
|
||||
gulp.task('all', gulp.series(gulp.parallel('scripts:compatdb', 'scripts:twitter', 'scripts:wiki'), gulp.parallel('assets:js', 'assets:scss'), 'hugo', 'assets:images', finalCommand))
|
||||
gulp.task('content', gulp.series('hugo', finalCommand))
|
||||
gulp.task('default', gulp.series(gulp.parallel('assets:js', 'assets:scss'), 'hugo', 'assets:images', finalCommand));
|
||||
gulp.task('all', gulp.series(gulp.parallel('scripts:compatdb', 'scripts:wiki'), gulp.parallel('assets:js', 'assets:scss'), 'hugo', 'assets:images', finalCommand));
|
||||
gulp.task('content', gulp.series('hugo', finalCommand));
|
||||
|
|
21
package.json
21
package.json
|
@ -4,7 +4,8 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"build": "gulp all --production",
|
||||
"serve": "gulp all"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,18 +18,20 @@
|
|||
},
|
||||
"homepage": "https://github.com/yuzu-emu/yuzu-emu.github.io#readme",
|
||||
"dependencies": {
|
||||
"bulma": "0.7.2",
|
||||
"cssnano": "^4.1.7",
|
||||
"gulp": "^4.0.0",
|
||||
"bulma": "0.9.0",
|
||||
"concurrent-transform": "^1.0.0",
|
||||
"cssnano": "^4.1.10",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-image-resize": "^0.13.0",
|
||||
"gulp-image-resize": "^0.13.1",
|
||||
"gulp-postcss": "^8.0.0",
|
||||
"gulp-sass": "^4.0.2",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-sass": "^4.1.0",
|
||||
"gulp-util": "^3.0.8",
|
||||
"merge-stream": "^1.0.1"
|
||||
"merge-stream": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.23.5",
|
||||
"xo": "^0.23.0"
|
||||
"browser-sync": "^2.26.10",
|
||||
"xo": "^0.32.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 03ec0b3e80312dd4878805917a865ad5e23e310e
|
||||
Subproject commit ccbc6671f302fe2f8ad9efcc78616ecf636888eb
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/* 2. Set the derived variables */
|
||||
@import "./yuzu/yuzu_before_derived.scss";
|
||||
@import "./node_modules/bulma/sass/utilities/derived-variables.sass";
|
||||
@import "./node_modules/bulma/sass/utilities/derived-variables.scss";
|
||||
@import "./yuzu/yuzu_after_derived.scss";
|
||||
|
||||
/* 3. Misc customization of Bulma */
|
||||
|
@ -18,4 +18,4 @@
|
|||
|
||||
/* 5. Bring in other external vendor SCSS to bake in */
|
||||
@import "./vendor/glide.scss";
|
||||
@import "./vendor/baguetteBox.min"
|
||||
@import "./vendor/baguetteBox.min";
|
||||
|
|
Loading…
Reference in a new issue