fix(sprites): add habitica-images as submodule
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
website/build
|
website/build
|
||||||
website/raw_sprites/spritesmith
|
|
||||||
website/transpiled-babel/
|
website/transpiled-babel/
|
||||||
website/common/transpiled-babel/
|
website/common/transpiled-babel/
|
||||||
node_modules
|
node_modules
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "habitica-images"]
|
||||||
|
path = habitica-images
|
||||||
|
url = https://github.com/HabitRPG/habitica-images
|
||||||
+2
-38
@@ -4,7 +4,6 @@ import spritesmith from 'gulp.spritesmith';
|
|||||||
import clean from 'rimraf';
|
import clean from 'rimraf';
|
||||||
import sizeOf from 'image-size';
|
import sizeOf from 'image-size';
|
||||||
import mergeStream from 'merge-stream';
|
import mergeStream from 'merge-stream';
|
||||||
import { basename } from 'path';
|
|
||||||
import { sync } from 'glob';
|
import { sync } from 'glob';
|
||||||
import { each } from 'lodash';
|
import { each } from 'lodash';
|
||||||
import vinylBuffer from 'vinyl-buffer';
|
import vinylBuffer from 'vinyl-buffer';
|
||||||
@@ -118,47 +117,12 @@ function createSpritesStream (name, src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('sprites:main', () => {
|
gulp.task('sprites:main', () => {
|
||||||
const mainSrc = sync('website/raw_sprites/spritesmith/**/*.png');
|
const mainSrc = sync('habitica-images/**/*.png');
|
||||||
return createSpritesStream('main', mainSrc);
|
return createSpritesStream('main', mainSrc);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('sprites:largeSprites', () => {
|
|
||||||
const largeSrc = sync('website/raw_sprites/spritesmith_large/**/*.png');
|
|
||||||
return createSpritesStream('largeSprites', largeSrc);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('sprites:clean', done => {
|
gulp.task('sprites:clean', done => {
|
||||||
clean(`${IMG_DIST_PATH}spritesmith*,${CSS_DIST_PATH}spritesmith*}`, done);
|
clean(`${IMG_DIST_PATH}spritesmith*,${CSS_DIST_PATH}spritesmith*}`, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('sprites:checkCompiledDimensions', gulp.series('sprites:main', done => {
|
gulp.task('sprites:compile', gulp.series('sprites:clean', 'sprites:main', done => done()));
|
||||||
console.log('Verifying that images do not exceed max dimensions'); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
let numberOfSheetsThatAreTooBig = 0;
|
|
||||||
|
|
||||||
const distSpritesheets = sync(`${IMG_DIST_PATH}*.png`);
|
|
||||||
|
|
||||||
each(distSpritesheets, img => {
|
|
||||||
const spriteSize = calculateImgDimensions(img);
|
|
||||||
|
|
||||||
if (spriteSize > MAX_SPRITESHEET_SIZE) {
|
|
||||||
numberOfSheetsThatAreTooBig += 1;
|
|
||||||
const name = basename(img, '.png');
|
|
||||||
console.error(`WARNING: ${name} might be too big - ${spriteSize} > ${MAX_SPRITESHEET_SIZE}`); // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (numberOfSheetsThatAreTooBig > 0) {
|
|
||||||
// https://github.com/HabitRPG/habitica/pull/6683#issuecomment-185462180
|
|
||||||
console.error( // eslint-disable-line no-console
|
|
||||||
`${numberOfSheetsThatAreTooBig} sheets might too big for mobile Safari to be able to handle
|
|
||||||
them, but there is a margin of error in these calculations so it is probably okay. Mention
|
|
||||||
this to an admin so they can test a staging site on mobile Safari after your PR is merged.`,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
console.log('All images are within the correct dimensions'); // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
}));
|
|
||||||
|
|
||||||
gulp.task('sprites:compile', gulp.series('sprites:clean', 'sprites:checkCompiledDimensions', done => done()));
|
|
||||||
|
|||||||
Submodule
+1
Submodule habitica-images added at 0d994d9344
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 152 KiB |
Reference in New Issue
Block a user