Git Product home page Git Product logo

Comments (6)

dhh avatar dhh commented on August 15, 2024 4

Hmm, yeah, that's a good issue. Probably need some way for the compressor to only apply to certain files. I'll have a look at that. And also, we need to document how to include the engine views to consider those – because that might well be relevant for Tailwind too, if you use that in your engines.

from tailwindcss-rails.

kaspth avatar kaspth commented on August 15, 2024 1

👋, haven't used Administrate but I'm guessing it's a Rails::Engine, so those views aren't considered, so the compressor would need to be told to look at those view files via something like:

config.assets.css_compressor = Tailwindcss::Compressor.new(files_with_class_names: Rails.root.glob("some/engine/root/**/*.*"))

(I don't know where to find the engine root though, depends on the gem install.)

But seems tailwindcss-rails should be Rails::Engine aware and the default app/views and app/helpers directories shouldn't be tied to just Rails.root necessarily. Can't remember how Rails::Engines automatically add their views to the main Rails app, but when we find that, I think we can reuse that to siphon extra locations to look.

from tailwindcss-rails.

stephenson avatar stephenson commented on August 15, 2024

Yeah, I think it's a good solution to make et engine aware. Just as a side note: There is stuff in the administrate.css file after purge because I have generated some of the Administrate views in the app/views folder.

I will go hunting for the path to the Administrate views :)

from tailwindcss-rails.

Bramjetten avatar Bramjetten commented on August 15, 2024

We've added Tailwind to our Rails engine (without webpacker) by compiling a custom build using npx that gets imported by Sprockets. It'd be great if instead of using npx to purge unnecessary classes, we could use this Purger to target our Tailwind build specifically (and skip the main app's stylesheets). I believe (as discussed in #1) it's better to do this in a separate gem though.

from tailwindcss-rails.

stephenson avatar stephenson commented on August 15, 2024

Hmm, yeah, that's a good issue. Probably need some way for the compressor to only apply to certain files. I'll have a look at that. And also, we need to document how to include the engine views to consider those – because that might well be relevant for Tailwind too, if you use that in your engines.

I think a good start would be to have an option to only purge Tailwind as it's already a separate file, which would make it less intrusive.

I am also a big fan of a general purger gem.

from tailwindcss-rails.

stephenson avatar stephenson commented on August 15, 2024

The fix works great, thanks 🥰

from tailwindcss-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.