Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HAML to watcher for Rails 7 apps using Tailwind? #177

Open
matt17r opened this issue Oct 18, 2021 · 2 comments
Open

Add HAML to watcher for Rails 7 apps using Tailwind? #177

matt17r opened this issue Oct 18, 2021 · 2 comments

Comments

@matt17r
Copy link

matt17r commented Oct 18, 2021

I had to manually add the following line to tailwind.config.js in a rails 7 app using haml-rails to get the JIT compiler to work.

--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -2,6 +2,7 @@ module.exports = {
   mode: 'jit',
   purge: [
     './app/views/**/*.html.erb',
+    './app/views/**/*.html.haml',
     './app/helpers/**/*.rb',
     './app/javascript/**/*.js'
   ]

Is it worth including that in the install script? If so, do you want me to try my hand at a PR?

@rafafdz
Copy link

rafafdz commented Dec 22, 2021

I would say this a concern from the tailwind gem rather than haml. If Haml starts supporting external libraries specifics in their own code, they would have to be actively mainting it and effectively depend in third parties, which is never a good thing I would say

@gonzalezgjaime
Copy link

gonzalezgjaime commented Aug 25, 2022

Hi, I am new to Rails 7. When installing hail-rails on a bootstrap app
rails new app --css bootstrap
the generators create haml files accordingly; however, when using the tailwind option:
rails new app --css tailwind
The generators create html.erb files, and I have to manually convert them.

@matt17r looking at your comment, I attempted to do the same; however my tailwind.config.js differs from your example:

const defaultTheme = require('tailwindcss/defaultTheme')

module.exports = {
  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',
    './app/views/**/*.{erb,haml,html,slim}'
  ],
  theme: {
    extend: {
      fontFamily: {
        sans: ['Inter var', ...defaultTheme.fontFamily.sans],
      },
    },
  },
  plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/aspect-ratio'),
    require('@tailwindcss/typography'),
  ]

Any pointers on this would be much appreciated, regards.

Jaime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants