Repository | GitHub pages home page | Base path |
---|---|---|
github.com/Weiyuan-Lane/weiyuan-lane.github.io | http://weiyuan-lane.github.io | / |
github.com/Weiyuan-Lane/spa-github-page-template | http://weiyuan-lane.github.io/spa-github-page-template | /spa-github-page-template |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withSass = require('@zeit/next-sass'); | |
const path = require('path'); | |
const CompressionPlugin = require('compression-webpack-plugin'); | |
module.exports = withSass({ | |
webpack: function(config) { | |
config.module.rules.push( | |
{ | |
test: /\.(jpe?g|png|gif|svg|ico)$/, | |
use: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CompressionPlugin = require('compression-webpack-plugin'); | |
module.exports = { | |
webpack: function(config) { | |
config.plugins.push(new CompressionPlugin()); | |
return config; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"publish": "subpath-as-branch --path dist --branch gh-pages" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const basePath = '/spa-github-page-template'; // or '' if basePath needs to be left unchanged | |
const webpackBasePath = process.env.SPA_EXP_BUILD === 'true' ? basePath : ''; | |
module.exports = { | |
assetPrefix: webpackBasePath, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Link from 'next/link'; | |
import PropTypes from 'prop-types' | |
import getConfig from 'next/config' | |
const { publicRuntimeConfig } = getConfig() | |
const basePath = publicRuntimeConfig.basePath || '' | |
const basePathEndsWithSlash = basePath.endsWith('/') | |
export default function BasePathLink({ href, children, ...props }){ | |
let finalHref |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const basePath = '/spa-github-page-template'; // or '' if basePath needs to be left unchanged | |
const webpackBasePath = process.env.SPA_EXP_BUILD === 'true' ? basePath : ''; | |
module.exports = { | |
publicRuntimeConfig: { | |
basePath: webpackBasePath, | |
}, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BasePathLink from 'BasePathLink'; | |
export default function Home() { | |
return ( | |
<div> | |
This is an empty page, to test this SPA.<br/> | |
You should just go <BasePathLink href='/'><a>home</a></BasePathLink><br/> | |
Or you can go <BasePathLink href='/deep'><a>deep</a></BasePathLink> |
Cloud Run | App Engine Flex (us-central1) | App Engine Flex (southamerica-east-1) | |
---|---|---|---|
Pricing blocks (second) | 0.1 | 1.0 | 1.0 |
$ Per vCPU-hour (USD) | 0.0864 | 0.0526 | 0.079 |
$ Per Ram-hour (USD) | 0.009 | 0.0071 | 0.011 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runtime: nodejs10 | |
instance_class: B1 | |
manual_scaling: | |
instances: 1 | |
handlers: | |
- url: /static | |
static_dir: static | |
- url: /public | |
static_dir: public |