Skip to content

Commit

Permalink
fix: purge the right css classes on build
Browse files Browse the repository at this point in the history
  • Loading branch information
thealpha93 committed May 22, 2021
1 parent 65fa848 commit d9c82da
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 12 deletions.
19 changes: 11 additions & 8 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module.exports = {
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.node = {
fs: 'empty'
}
}
return config;
// webpack: (config, { isServer }) => {
// // Fixes npm packages that depend on `fs` module
// if (!isServer) {
// config.node = {
// fs: 'empty'
// }
// }
// return config;
// },
future: {
webpack5: true
}
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "rm -rf .next/ && cross-env NODE_ENV=production next build",
"start": "next start"
},
"dependencies": {
Expand Down Expand Up @@ -49,6 +49,8 @@
},
"devDependencies": {
"autoprefixer": "^10.2.5",
"cross-env": "^7.0.3",
"fast-glob": "^3.2.5",
"postcss": "^8.2.10",
"tailwindcss": "^2.1.1",
"webpack": "^5.33.2"
Expand Down
3 changes: 3 additions & 0 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import "../styles/slick.scss";
import "../styles/slick-theme.scss";
import "highlight.js/styles/default.css";
import "../component/Editorjs/tools/embedTool/index.css"
import "../styles/Home.module.scss";

import 'tailwindcss/tailwind.css'

function MyApp({ Component, pageProps }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SectionSwag from "../component/layout/SectionSwag/SectionSwag";
import SectionUsers from "../component/layout/SectionUsers/SectionUsers";
import Head from "next/head";

import "../styles/Home.module.scss";
// import "../styles/Home.module.scss";

export default function Home() {
return (
Expand Down
7 changes: 6 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// some of the classes used is being purged after build is done.
// solution: https://github.com/tailwindlabs/tailwindcss/issues/4009
const fg = require('fast-glob');
const purgeFiles = fg.sync(['./src/pages/**/*.jsx', './src/components/**/*.jsx'], { dot: false });

module.exports = {
purge: ["./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
purge: purgeFiles,
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
Expand Down
47 changes: 46 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,22 @@ crelt@^1.0.5:
resolved "https://registry.npmjs.org/crelt/-/crelt-1.0.5.tgz"
integrity sha512-+BO9wPPi+DWTDcNYhr/W90myha8ptzftZT+LwcmUbbok0rcP/fequmFYCw8NMoH7pkAZQzU78b3kYrlua5a9eA==

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^7.0.1:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
which "^2.0.1"

[email protected], crypto-browserify@^3.11.0:
version "3.12.0"
resolved "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz"
Expand Down Expand Up @@ -1685,7 +1701,7 @@ fast-deep-equal@^3.1.1:

fast-glob@^3.2.5:
version "3.2.5"
resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661"
integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
Expand Down Expand Up @@ -2213,6 +2229,11 @@ [email protected], isarray@^1.0.0, isarray@~1.0.0:
resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=

isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=

isobject@^2.0.0:
version "2.1.0"
resolved "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz"
Expand Down Expand Up @@ -2892,6 +2913,11 @@ path-is-absolute@^1.0.0:
resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=

path-key@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==

path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz"
Expand Down Expand Up @@ -3385,6 +3411,18 @@ shallowequal@^1.1.0:
resolved "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz"
integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==

shebang-command@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
dependencies:
shebang-regex "^3.0.0"

shebang-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==

[email protected]:
version "1.7.2"
resolved "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz"
Expand Down Expand Up @@ -4002,6 +4040,13 @@ which-typed-array@^1.1.2:
has-symbols "^1.0.1"
is-typed-array "^1.1.3"

which@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
dependencies:
isexe "^2.0.0"

wrappy@1:
version "1.0.2"
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
Expand Down

0 comments on commit d9c82da

Please sign in to comment.