Comments (6)
Hey @Tonksthebear
I am just sitting in front of my old 2012 mb pro, ready to start a new done-on-weekends e-commerce app with rails 6.1, hotwire and TailwindCSS. I also need a lot a few tweaks of CSS definitions for repetitive tags such as tables, forms, and specially buttons.
I think the big problem here is how can I have SM like tailwind's @apply
using Sprockets. SASS has a @extend
that works as @apply
.
SASS has also @import
to create chunks of CSS.
Therefore, I think is better to use SASS instead of helpers.
I will play around the idea...
from tailwindcss-rails.
I'm also wondering how to tackle the missing @apply
. I love being able to use the asset pipeline instead of webpacker for tailwind, but not having @apply
is a drawback for sure. Using rails-helpers/partials could work as a workaround, but doesn't feel quite as clean. Interested in how your experimentation goes @ccastillop!
from tailwindcss-rails.
This is interesting! 🤔
YAML? Where do you put this file?
from tailwindcss-rails.
@ccastillop I definitely get what you're saying. SASS would be best, but I assumed tailwind required the special @apply keyword because they need to do something special to actually @include the styles. So I just decided to do the quickest solution I could think of that felt relatively clean without diving into any source code.
@leehericks I have an internal gem I made for reusable components across my various projects, so I just added a namespaces config directory for that in my config directory.
config/namespace/styles.yml
Then I made a simple helper that just concats any styles from this file with the given arguments.
Ultimately though, tailwind jit mode makes the benefits of just using the node version outweigh the benefits of relying on strictly the asset pipeline. For my uses, I just use jit mode with webpacker and stick with asset pipeline for js. #50 has interesting suggestions for how to do this without webpacker (still node). I'm still using my yaml helper because I like seeing the actual classes in web inspector, vs @apply which would hide the actual classes behind the given class name (ex. .btn).
from tailwindcss-rails.
I'd be happy to see @apply implemented as a sprockets processor, if possible. Not going to rely on node for this particular gem. Please do open a PR if you end up exploring that!
from tailwindcss-rails.
Following back on this to provide some extra info. For anyone who needs @import
because they aren't using a bundler, I made classy-yaml to solve this issue. It leverages YAML files in order to provide similar functionality.
from tailwindcss-rails.
Related Issues (20)
- Upgrading tailwindcss-rails from 2.0.29 to 2.0.30 broke web-console HOT 14
- rails tailwindcss:build ELF not found error HOT 4
- caniuse-lite is outdated and cannot update without package.json HOT 1
- bg-[url(...)] not working with rails_blob_url (active_storage)
- v2.0.31 Fails on ruby 2.7.x HOT 6
- Browserslist: caniuse-lite is outdated. HOT 1
- RUBY_DEBUG_OPEN=true in Procfile.dev breaks running Rails app within Docker container HOT 4
- Colours not being applied as they should in Rails 7.0.8 and Ruby 3.2.2 HOT 1
- Browserslist: caniuse-lite is outdated. Please run: 21:49:24 css.1 | npx update-browserslist-db@latest HOT 1
- Remove Inter font assets from inclusion in downstream projects HOT 6
- Support @config directive and multiple *.tailwind.css files HOT 1
- use scaffold generate password class is nil HOT 2
- `rails tailwindcss:build` causes Segmentation fault for Ruby 3.3.0 on aarch64-linux HOT 3
- tailwindcss:watch terminates with exception HOT 10
- uninitialized constant Tailwindcss (NameError) when launching puma HOT 16
- Watcher not working in Docker even with `tty:true` HOT 2
- How do I get the color palette from the tailwind docs to work? HOT 1
- Allow to choose between Procfile.dev or Puma plugin
- Classes not loaded while building
- TailwindCSS does not support react-on-rails with scss HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss-rails.