Skip to content

Commit

Permalink
Make purgecss work only on build
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-here committed Jul 26, 2024
1 parent 30f5475 commit 737efff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/scripts/components/common/banner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Banner({appTitle, expires, url, text, type = infoTypeFla
</USWDSBanner>
<div className='position-absolute top-0 right-0 margin-right-3 height-full display-flex'>
<button
className='usa-button usa-button--secondary usa-button--unstyled'
className='usa-button usa-button--unstyled'
type='button'
aria-label='Close Banner'
onClick={onClose}
Expand Down
1 change: 0 additions & 1 deletion app/scripts/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const Sandbox = lazy(() => import('$components/sandbox'));

const UserPagesComponent = lazy(() => import('$components/user-pages'));


// Contexts
import { ReactQueryProvider } from '$context/react-query';
import {
Expand Down
29 changes: 15 additions & 14 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
let plugins = [require('autoprefixer'), require('postcss-import')];
const purge = require('@fullhuman/postcss-purgecss')({
content: [
'./app/**/*.{js,jsx,ts,tsx}',
'@trussworks/react-uswds/lib/index.css'
],
safelist: {
deep: [/usa-banner$/],
greedy: [/^usa-banner/]
}
});

if (process.env.NODE_ENV !== 'development') plugins = [...plugins, purge];

module.exports = {
syntax: 'postcss-scss',
parser: 'postcss-safe-parser',
plugins: [
require('autoprefixer'),
require('postcss-import'),
require('@fullhuman/postcss-purgecss')({
content: [
'./app/**/*.{js,jsx,ts,tsx}',
'@trussworks/react-uswds/lib/index.css'
],
safelist: {
deep: [/usa-banner$/],
greedy: [/^usa-banner/]
}
})
]
plugins
};

0 comments on commit 737efff

Please sign in to comment.