Created
October 19, 2018 02:02
-
-
Save burnoutprojects/bd4e0927410973e0bb7a3fb59f47205e to your computer and use it in GitHub Desktop.
Config for Vue with Tailwind.css and PurgeCss
This file contains 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 Vue from "vue"; | |
import App from "./App.vue"; | |
import "@/assets/tailwind.css"; | |
Vue.config.productionTip = false; | |
new Vue({ | |
render: h => h(App) | |
}).$mount("#app"); |
This file contains 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 glob = require("glob-all"); | |
const path = require("path"); | |
const tailwindcss = require("tailwindcss"); | |
const autoprefixer = require("autoprefixer"); | |
const cssnano = require("cssnano"); | |
const purgecss = require("@fullhuman/postcss-purgecss"); | |
// Custom PurgeCSS extractor for Tailwind that allows special characters in class names. | |
// https://github.com/FullHuman/purgecss#extractor | |
class TailwindExtractor { | |
static extract(content) { | |
return content.match(/[A-Za-z0-9-_:/]+/g) || []; | |
} | |
} | |
module.exports = { | |
plugins: [ | |
tailwindcss("./tailwind.js"), | |
autoprefixer({ | |
add: true, | |
grid: true | |
}), | |
cssnano({ | |
preset: "default" | |
}), | |
purgecss({ | |
content: glob.sync([path.join(__dirname, "./src/**/*.vue")]), | |
extractors: [ | |
{ | |
extractor: TailwindExtractor, | |
// Specify the file extensions to include when scanning for class names. | |
extensions: ["vue"] | |
} | |
], | |
whitelist: ["html", "body"] | |
}) | |
] | |
}; |
This file contains 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
@tailwind preflight; | |
@tailwind components; | |
@tailwind utilities; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment