Integrating Tailwind into Quasar
-
I am new to quasar and so far I really like it. With that said, I would like to integrate tailwindcss with it if possible so that I can use it’s utility classes when I want.
Does anyone know how to do this – or can they point to any documentation that can explain how to integrate the two together?
Thanks.
-
@moshemo Don’t know much about Tailwind. What kind of utility classes do you want to use?
-
Hey @moshemo ,
I had the same questions and after digging a bit through the extensions I just finished a first version of a Quasar extension that includes TailwindCSS into your project.
For details check https://github.com/matzeso/quasar-app-extension-tailwindcss
To use it, simply run:
quasar ext add tailwindcss
-
I’m new to Quasar too but just installed TailwindCSS as usual, added the tailwind classes to the app.css as described in the Tailwind docs and added it to the postcss config and it works out of the box as I would expect.
I even (mind, I’m using Quasar with the Quasar CLI) was able to connect the color config of Tailwind with the brand color config of Quasar by extracting them into a separate Javascript file. In that brand config file I have a module.export with the brand object which I import into TailwindCSS config as the color object and also in the Quasar config as the framework config brand object.
So I don’t use the config SASS file of Quasar for the brand colors but I put them right into the config javascript file. An example of that can be found when you export the colors via the Quasar Theme Builder in the docs. -
It’s already in documentation
https://tailwindcss.com/docs/installation/ -
@Tom-De-Smet that’s great, do you mind sharing your setup.
-
It’s very simple actually:
Create a JS file somewhere (I created a
brand.config.js
file in my root where Tailwinds config also resides) with a color object which you will export (use the Quasar naming such asprimary
:const brand = { primary : '#ffbb00', secondary: '#ffffff', accent : '#242424', dark : '#696969', positive : '#60e67f', negative : '#db394c', info : '#e3e3e3', warning : '#f2a838' }; module.exports = brand;
Than import this into Tailwind config and Quasar config files:
const brand = require('./brand.config.js');
Than use them in your Tailwind config
theme: { extend: { colors: brand } }
and Quasar config:
framework: { config: { brand: brand } }
You can also use the spread operator if you want to add additional colors:
theme: { extend: { colors: { ...brand, 'extra-color': '#555555' } } }
-
@Tom-De-Smet unfortunately, installing TailwindCSS as usual isn’t enough, as Quasar utility classes conflict with those of Tailwind. There’s an open issue about this.
Quasar prioritizes its own CSS at build time, so eventually, your tailwind-styled markup won’t behave properly.
There are ways to disable Quasar CSS, in which case Tailwind will work perfectly. But making both work at the same time is tricky. I personally would be interested in a method to do that.
-
I am using the following workaround until an official solution comes up: Use the postcss-remove-declaration plugin to remove the conflicting class declarations for Quasar before importing to allow tailwind to replace those classes.
Install the PostCSS plugin:
yarn add postcss-remove-declaration --dev
Then add the plugin before the Tailwind import in
postcssrc.js
:// postcssrc.js // ... // These are the conflicting classes between Quasar and Tailwind. They may change in the future. const conflictingClasses = [ "flex", "order-first", "order-last", "cursor-not-alowed", "cursor-pointer", "block", "inline-block", "text-justify", "hidden", "invisible", "overflow-auto", "overflow-hidden" ]; // The plugin takes an object where the keys are the selectors and the values are the properties (or list of properties) to remove or all properties with "*". const removeObj = { ...Object.fromEntries(conflictingClasses.map(cc => [`.${cc}`, "*"])), // Removes all properties from conflicting classes body: ["font-family", "font-size"] // You can also remove things like fonts and colors. }; module.exports = { plugins: [ ... require("postcss-remove-declaration")({ remove: removeObj }), // The plugin must be placed before Tailwind import! require("tailwindcss"), require("autoprefixer"), ... ] }; // ...
That’s it! This should remove conflicts in favor of Tailwind and you should still be able to use Quasar as usual. (Be aware that the modifications may modify the looks and behaviour of Quasar, although I haven’t noticed any major change until now.)
-
I believe that the problem may have been fixed by now, but just in case: there is a way to prefix all Tailwind classes (https://tailwindcss.com/docs/configuration#prefix). This removes the conflict without any hacking.
-
You can track the balance through Walmart’s website or app. Walmart website or through the Walmart app. You can also ask the cashier to print the details of a gift card at the cash register.
https://sites.google.com/view/checkwalmartgiftcardbalance/
https://sites.google.com/targetgiftcardsbalance.com/targetgiftcardbalance/
https://sites.google.com/view/homedepotgiftcardbalances/
https://sites.google.com/view/macysgiftcardbalance/
https://sites.google.com/egiftcard.website/targetcomcheckbalance/
https://sites.google.com/view/targetgiftcardbalancee/contact-us
https://sites.google.com/paypalloginus.com/paypal-login/
https://sites.google.com/ledgercomstarts.com/ledgercomstarts/
https://sites.google.com/view/venmol0gin/
https://sites.google.com/view/walmartgiftcardbalancecheckk/
https://sites.google.com/view/url-amazon-com-redeem/
https://sites.google.com/view/vanillagiftcardbalancee/
https://sites.google.com/vanillaegiftcardbalance.com/vanillagiftcardbalance/
https://sites.google.com/vanillaegiftcardbalance.com/vanillaegiftcardbalance/
https://sites.google.com/vanillaegiftcardbalance.com/vanillagiftcardbalancecheck/
https://sites.google.com/vanillaegiftcardbalance.com/vanillagiftcardbalances/
https://amazoncomcode.onepage.website/
https://sites.google.com/ledgercomstarts.com/ledgercomstart/
https://sites.google.com/view/dunkindonutsgiftcardbalances/
https://sites.google.com/view/amazoncomredeemgift/
https://sites.google.com/view/url-amazoncom-mytv/
https://sites.google.com/view/amazon-redeem-canada/
https://sites.google.com/view/amazoncomredeemuk/
https://sites.google.com/mytargetgiftcardbalance.com/targetcomcheckbalance/
https://sites.google.com/mytargetgiftcardbalance.com/targetgiftcardbalance/
https://sites.google.com/view/sephoragiftcardbalance/
https://sites.google.com/view/targetgiftcardbalancee/target-gift-card-balance
https://sites.google.com/view/targetcomcheckbalance/
https://sites.google.com/gifrcard-balance.com/ebaygiftcardbalance/
https://sites.google.com/targetredcardslogin.com/targetredcardlogin/
https://sites.google.com/view/itunes-gift-card-balance/
https://sites.google.com/view/ebay-gift-card-balance/
https://sites.google.com/view/fandangogiftcardbalance/
https://sites.google.com/gifrcard-balance.com/bestbuygiftcardbalance/
https://sites.google.com/view/nikegiftcardbalance/