commit
ab5f53273f
|
@ -81,6 +81,7 @@ function Media({ media, showOriginal, onClick }) {
|
||||||
alt={description}
|
alt={description}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
loading="lazy"
|
||||||
style={
|
style={
|
||||||
!showOriginal && {
|
!showOriginal && {
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
|
@ -163,6 +164,7 @@ function Media({ media, showOriginal, onClick }) {
|
||||||
alt={description}
|
alt={description}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -215,6 +217,7 @@ function Card({ card }) {
|
||||||
src={image}
|
src={image}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
loading="lazy"
|
||||||
alt=""
|
alt=""
|
||||||
onError={() => {
|
onError={() => {
|
||||||
this.style.display = 'none';
|
this.style.display = 'none';
|
||||||
|
@ -245,6 +248,7 @@ function Card({ card }) {
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
alt={title || description}
|
alt={title || description}
|
||||||
|
loading="lazy"
|
||||||
style={{
|
style={{
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
aspectRatio: `${width}/${height}`,
|
aspectRatio: `${width}/${height}`,
|
||||||
|
|
|
@ -186,6 +186,24 @@ export default ({ onClose }) => {
|
||||||
</a>
|
</a>
|
||||||
.
|
.
|
||||||
</p>
|
</p>
|
||||||
|
{__BUILD_TIME__ && (
|
||||||
|
<p>
|
||||||
|
Last build:{' '}
|
||||||
|
<relative-time datetime={new Date(__BUILD_TIME__).toISOString()} />{' '}
|
||||||
|
{__COMMIT_HASH__ && (
|
||||||
|
<>
|
||||||
|
(
|
||||||
|
<a
|
||||||
|
href={`https://github.com/cheeaun/phanpy/commit/${__COMMIT_HASH__}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<code>{__COMMIT_HASH__}</code>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
import preact from '@preact/preset-vite';
|
import preact from '@preact/preset-vite';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { defineConfig, splitVendorChunkPlugin } from 'vite';
|
import { defineConfig, splitVendorChunkPlugin } from 'vite';
|
||||||
|
|
||||||
|
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
define: {
|
||||||
|
__BUILD_TIME__: JSON.stringify(Date.now()),
|
||||||
|
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||||
|
},
|
||||||
plugins: [preact(), splitVendorChunkPlugin()],
|
plugins: [preact(), splitVendorChunkPlugin()],
|
||||||
build: {
|
build: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
|
|
Loading…
Reference in a new issue