Run it with "ng serve". I'm using VS-Code so I created a Chrome configuration in launch.json with "url": "http://localhost:4200".
As you can see, the "ms-4" directive adds a margin before the "Hello" button at the bottom of the page. "ms-4" is translated to "margin-inline-start: 1rem;".
Converting it to using ESM:
Stop the "ng serve" process.
Add to package.json: "type": "module"
"ng serve" will no longer work because 'tailwind.config' is a '.js' file. Change its to extension to '.cjs' and run "ng serve" again.
The tailwind classes no longer work because the '@import' lines don't work anymore. To make them work, I had to change them to:
Sorry for the late answer, but this doesn't seem to be related to tailwindcss-rtl. I have just tried successfully adding it to angular12 without any issue.
I can't get tailwindcss-rtl to work in Angular 12 when using ESM ("type": "module" in package.json). Steps to reproduce:
Working version:
Create a simple Angular 12 project using the CLI with "ng new a", select 'add Routing' and use SCSS.
Install tailwindcss with "npm i tailwindcss" and init it with "npx tailwindcss init". The version it installed was 2.2.7.
Install tailwindcss-rtl with "npm i -D tailwindcss-rtl". The version it installed was 0.7.3.
Add "require('tailwindcss-rtl')" to the 'plugins' section in the 'tailwind.config.js' file.
Add the following lines to 'src/styles.scss':
Add the following lines at the end of the 'src/app/app.component.html' file:
Run it with "ng serve". I'm using VS-Code so I created a Chrome configuration in launch.json with "url": "http://localhost:4200".
As you can see, the "ms-4" directive adds a margin before the "Hello" button at the bottom of the page. "ms-4" is translated to "margin-inline-start: 1rem;".
Converting it to using ESM:
Stop the "ng serve" process.
Add to package.json: "type": "module"
"ng serve" will no longer work because 'tailwind.config' is a '.js' file. Change its to extension to '.cjs' and run "ng serve" again.
The tailwind classes no longer work because the '@import' lines don't work anymore. To make them work, I had to change them to:
Tailwind works but tailwindcss-rtl doesn't work now. The "ms-4" directive is not a recognized class anymore.