Fixes for purge CSS

This commit is contained in:
Dane Everitt 2019-12-22 14:33:08 -08:00
parent 6276a03a4e
commit 5a31771b4b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 20 additions and 6 deletions

View file

@ -3,6 +3,7 @@ import { ITerminalOptions, Terminal } from 'xterm';
import * as TerminalFit from 'xterm/lib/addons/fit/fit'; import * as TerminalFit from 'xterm/lib/addons/fit/fit';
import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
import { ServerContext } from '@/state/server'; import { ServerContext } from '@/state/server';
import styled from 'styled-components';
const theme = { const theme = {
background: 'transparent', background: 'transparent',
@ -35,6 +36,16 @@ const terminalProps: ITerminalOptions = {
theme: theme, theme: theme,
}; };
const TerminalDiv = styled.div`
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-thumb {
${tw`bg-neutral-900`};
}
`;
export default () => { export default () => {
const [ terminalElement, setTerminalElement ] = useState<HTMLDivElement | null>(null); const [ terminalElement, setTerminalElement ] = useState<HTMLDivElement | null>(null);
const useRef = useCallback(node => setTerminalElement(node), []); const useRef = useCallback(node => setTerminalElement(node), []);
@ -94,13 +105,13 @@ export default () => {
<div className={'text-xs font-mono relative'}> <div className={'text-xs font-mono relative'}>
<SpinnerOverlay visible={!connected} size={'large'}/> <SpinnerOverlay visible={!connected} size={'large'}/>
<div <div
className={'rounded-t p-2 bg-black overflow-scroll w-full'} className={'rounded-t p-2 bg-black w-full'}
style={{ style={{
minHeight: '16rem', minHeight: '16rem',
maxHeight: '32rem', maxHeight: '32rem',
}} }}
> >
<div id={'terminal'} ref={useRef}/> <TerminalDiv id={'terminal'} ref={useRef}/>
</div> </div>
<div className={'rounded-b bg-neutral-900 text-neutral-100 flex'}> <div className={'rounded-b bg-neutral-900 text-neutral-100 flex'}>
<div className={'flex-no-shrink p-2 font-bold'}>$</div> <div className={'flex-no-shrink p-2 font-bold'}>$</div>

View file

@ -25,6 +25,7 @@
@apply .flex .items-center .h-full .no-underline .text-neutral-300 .px-6; @apply .flex .items-center .h-full .no-underline .text-neutral-300 .px-6;
transition: background-color 150ms linear, color 150ms linear, box-shadow 150ms ease-in; transition: background-color 150ms linear, color 150ms linear, box-shadow 150ms ease-in;
/*! purgecss start ignore */
&.active, &:hover { &.active, &:hover {
@apply .text-neutral-100 .bg-black; @apply .text-neutral-100 .bg-black;
box-shadow: inset 0 -2px config('colors.cyan-700'); box-shadow: inset 0 -2px config('colors.cyan-700');
@ -33,6 +34,7 @@
&.active { &.active {
box-shadow: inset 0 -2px config('colors.cyan-500'); box-shadow: inset 0 -2px config('colors.cyan-500');
} }
/*! purgecss end ignore */
} }
} }
} }
@ -43,6 +45,7 @@
.items { .items {
@apply .flex .items-center .text-sm .mx-2; @apply .flex .items-center .text-sm .mx-2;
/*! purgecss start ignore */
& > a, & > div { & > a, & > div {
@apply .inline-block .py-3 .px-4 .text-neutral-300 .no-underline; @apply .inline-block .py-3 .px-4 .text-neutral-300 .no-underline;
transition: color 150ms linear, box-shadow 150ms ease-in; transition: color 150ms linear, box-shadow 150ms ease-in;
@ -60,5 +63,6 @@
box-shadow: inset 0 -2px config('colors.cyan-500'); box-shadow: inset 0 -2px config('colors.cyan-500');
} }
} }
/*! purgecss end ignore */
} }
} }

View file

@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const _ = require('lodash');
const path = require('path'); const path = require('path');
const tailwind = require('tailwindcss'); const tailwind = require('tailwindcss');
const glob = require('glob-all'); const glob = require('glob-all');
@ -34,7 +33,7 @@ if (isProduction) {
{ {
extractor: class { extractor: class {
static extract (content) { static extract (content) {
return content.match(/[A-z0-9-:\/]+/g) || []; return content.match(/[A-Za-z0-9-_:\\/]+/g) || [];
} }
}, },
extensions: ['html', 'ts', 'tsx', 'js', 'php'], extensions: ['html', 'ts', 'tsx', 'js', 'php'],
@ -63,7 +62,7 @@ module.exports = {
path: path.resolve(__dirname, 'public/assets'), path: path.resolve(__dirname, 'public/assets'),
filename: isProduction ? 'bundle.[chunkhash:8].js' : 'bundle.[hash:8].js', filename: isProduction ? 'bundle.[chunkhash:8].js' : 'bundle.[hash:8].js',
chunkFilename: isProduction ? '[name].[chunkhash:8].js' : '[name].[hash:8].js', chunkFilename: isProduction ? '[name].[chunkhash:8].js' : '[name].[hash:8].js',
publicPath: _.get(process.env, 'PUBLIC_PATH', '') + '/assets/', publicPath: (process.env.PUBLIC_PATH || '') + '/assets/',
crossOriginLoading: 'anonymous', crossOriginLoading: 'anonymous',
}, },
module: { module: {
@ -168,7 +167,7 @@ module.exports = {
}, },
devServer: { devServer: {
contentBase: path.join(__dirname, 'public'), contentBase: path.join(__dirname, 'public'),
publicPath: _.get(process.env, 'PUBLIC_PATH', '') + '/assets/', publicPath: (process.env.PUBLIC_PATH || '') + '/assets/',
allowedHosts: [ allowedHosts: [
'.pterodactyl.test', '.pterodactyl.test',
], ],