Browse Source

added purgecss and cssnano

Danny Coates 6 years ago
parent
commit
d881755814
4 changed files with 620 additions and 426 deletions
  1. 3 3
      app/main.css
  2. 594 415
      package-lock.json
  3. 2 2
      package.json
  4. 21 6
      postcss.config.js

+ 3 - 3
app/main.css

@@ -1,6 +1,6 @@
-@import 'tailwindcss/preflight';
-@import 'tailwindcss/components';
-@import 'tailwindcss/utilities';
+@tailwind preflight;
+@tailwind components;
+@tailwind utilities;
 
 a {
   color: inherit;

File diff suppressed because it is too large
+ 594 - 415
package-lock.json


+ 2 - 2
package.json

@@ -64,6 +64,7 @@
     "@babel/polyfill": "^7.0.0",
     "@babel/preset-env": "^7.1.0",
     "@dannycoates/webpack-dev-server": "^3.1.4",
+    "@fullhuman/postcss-purgecss": "^1.1.0",
     "@mattiasbuelens/web-streams-polyfill": "0.1.0",
     "asmcrypto.js": "^2.3.2",
     "babel-loader": "^8.0.4",
@@ -76,6 +77,7 @@
     "cross-env": "^5.2.0",
     "css-loader": "^1.0.0",
     "css-mqpacker": "^7.0.0",
+    "cssnano": "^4.1.7",
     "eslint": "^5.6.1",
     "eslint-plugin-mocha": "^5.2.0",
     "eslint-plugin-node": "^7.0.1",
@@ -97,8 +99,6 @@
     "nanotiming": "^7.3.1",
     "npm-run-all": "^4.1.3",
     "nyc": "^13.0.1",
-    "postcss-cssnext": "^3.1.0",
-    "postcss-import": "^12.0.0",
     "postcss-loader": "^3.0.0",
     "prettier": "^1.14.3",
     "proxyquire": "^2.1.0",

+ 21 - 6
postcss.config.js

@@ -1,10 +1,25 @@
-const options = {
-  plugins: {
-    'postcss-import': {},
-    tailwindcss: {},
-    'postcss-cssnext': {},
-    'css-mqpacker': {}
+class TailwindExtractor {
+  static extract(content) {
+    return content.match(/[A-Za-z0-9-_:/]+/g) || [];
   }
+}
+
+const options = {
+  plugins: [
+    require('tailwindcss')('./tailwind.js'),
+    require('@fullhuman/postcss-purgecss')({
+      content: ['./app/*.js', './app/ui/*.js'],
+      extractors: [
+        {
+          extractor: TailwindExtractor,
+          extensions: ['js']
+        }
+      ]
+    }),
+    require('cssnano')({
+      preset: 'default'
+    })
+  ]
 };
 
 if (process.env.NODE_ENV === 'development') {

Some files were not shown because too many files changed in this diff