Comments (10)
this done the work in purgecssOptions:
whitelistPatternsChildren: [/prose$/],
from tailwindcss-typography.
Hey! Thank you for your bug report!
Much appreciated! 🙏
By default purge will purge everything that it can't find. Essentially if you build the markdown files, and <h2>
is not present then it will remove .prose h2
. If your markdown content is coming from some form database/API, then you would have to safelist all the .prose
related styles (because you don't know what you will get from your DB/API).
You can use the /prose$/
regex that @lowv-developer provided.
Also see: https://tailwindcss.com/docs/optimizing-for-production#purge-css-options
from tailwindcss-typography.
I'm also having issues with PurgeCSS
. I am only using prose
and prose-xl
classes in my html, but purgecss
is not removing the other prose classes (sm lg 2xl
) from the production build.
So my 20kb
css file ends up over 120kb
because of this issue.
from tailwindcss-typography.
I've updated my previous comment to include the dependencies. Using tailwindcss 1.5.2 still strips out classes such as .lg\:prose-lg h2
which I need to include in the whitelist.
from tailwindcss-typography.
Thanks, @lowv-developer! It did work! 👍
from tailwindcss-typography.
I have similar problem especially for responsive classes such as lg:prose-lg
. I don't have .lg\:prose-lg h2
, .lg\:prose-lg pre
, etc.
I ended up having this config for tailwind.config.js
:
module.exports = {
purge: {
mode: 'all',
content: [
'layouts/**/*.html'
],
options: {
whitelist: ['h2', 'pre', 'code']
}
},
variants: {},
plugins: [
require('@tailwindcss/typography')
]
}
and my main.css
:
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */
@tailwind utilities;
Dependencies:
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ @tailwindcss/[email protected]
So I am wondering what is the best way to use PurgeCSS
with tailwindcss-typography
.
from tailwindcss-typography.
Typography plugin needs tailwindcss v1.50
#43
from tailwindcss-typography.
yeah you right, I have some issues myself with 1.5.2 and class .prose table tr
maybe the solution would be in this direction tailwindlabs/discuss#250
can we import prose somehow in the scss file so then we can do purgecss start ignore?
from tailwindcss-typography.
I'm also having issues with
PurgeCSS
. I am only usingprose
andprose-xl
classes in my html, butpurgecss
is not removing the other prose classes (sm lg 2xl
) from the production build.So my
20kb
css file ends up over120kb
because of this issue.
@oxalorg You may need to manually disable unused modifiers. After I disabled all modifiers except default
according to Disabling size modifiers, the file dropped from 86KB to 33KB. But this is not small enough. Chrome says that there are still 78% unused css. I suspect purgecss did not clean up @tailwindcss/typography.
from tailwindcss-typography.
Ran into the same problem with Eleventy, my solution was to run 11ty first and then run Tailwind:
purge settings in tailwind.config.js
:
purge: {
mode: 'all',
content: ['_site/**/*.html'],
},
build command in package.json
:
"build": "eleventy && NODE_ENV=production postcss src/css/tailwind.css --o _site/css/style.css"
The only downside (that I know so far) is that you can't inline css.
from tailwindcss-typography.
Related Issues (20)
- Generated classes do not respect base tailwind.config "important" setting HOT 2
- `not-prose` does not reset `prose-lg` HOT 2
- Bottom margin is not reset for last child when redefined in lg prose HOT 2
- Wrong order of custom utilities and prose with variant HOT 3
- 0.5.10 causes '[class~=not-prose] *)):before' is not a valid selector HOT 5
- Peer dependency invalid version requirement HOT 1
- `prose-code` targets both inline and block code HOT 5
- Bad DX: [object Object] appearing in CSS when customizing typography
- Unable to change video size using prose-video:{utility} HOT 3
- Does not work on wechat webview HOT 1
- Numbered lists are being cut off HOT 1
- Markdown Rendered Graphs Overflows the Screen HOT 1
- Type error in the config: Binding element 'theme' implicitly has an 'any' type. HOT 1
- Links don't have a default hover state HOT 3
- Prose not formatting markdown tables correctly HOT 1
- The rendered image height is incorrect. HOT 1
- headings modifier does not work HOT 5
- Prose class adds inner border to specific font on Chrome HOT 2
- Different rendering on Firefox HOT 3
- @apply prose is failing the first- and last-child selectors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss-typography.