christopherdro / react-native-html-to-pdf

Convert html strings to PDF documents using React Native
MIT License
434 stars 264 forks source link

Is it possible to use sass or tailwind for css styling? #283

Closed xbaldiq closed 1 year ago

xbaldiq commented 1 year ago

The inline styling is working fine, but can we use alternative styling method?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

johnfrades commented 1 year ago

hi @xbaldiq i was able to add tailwind on this thru cdn, more info here https://tailwindcss.com/docs/installation/play-cdn

<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
  <h1 class="text-3xl font-bold underline">
    Hello world!
  </h1>
</body>
</html>
rizki-tabist commented 1 year ago

hi @xbaldiq i was able to add tailwind on this thru cdn, more info here https://tailwindcss.com/docs/installation/play-cdn

<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
  <h1 class="text-3xl font-bold underline">
    Hello world!
  </h1>
</body>
</html>

yes, this workaround is working fine on iOS. However, on Android, the tailwind is not loaded. It might be because the javascript is not enabled. https://github.com/christopherdro/react-native-html-to-pdf/issues/239#issuecomment-1058125888