DEV Community

Discussion on: Use Tailwind CSS 1.1 in your Rails App

Collapse
 
mdahab profile image
Mohammad Dahab

I don't think you should put stylesheets.css inside /packs folder, It will be considered a "pack" and will be compiled to stylesheets-[hash].js.

Collapse
 
andrewmcodes profile image
Andrew Mason

Can you elaborate, please? I do this bc it’s the “rails way” a typically only find pain when I stray from this path. What do you prefer to do?

Collapse
 
mdahab profile image
Mohammad Dahab • Edited

/packs Is a special folder that contains the entry points to your "modules" (webpacker will bundle up each file inside /packs with its dependencies into single file).

So, If you have packs/application.js it will be bundled up with its dependencies and become available as example.com/packs/js/application-[hash].js (Find that in the <head> of your website).

If you check your deployment, you will find example.com/packs/stylesheets-[hash].css which is basically useless because your styles are already bundled to example.com/packs/css/application-[hash].css because of the import './stylesheets.css' you have in app/javascript/packs/application.js already.

Having stylesheets.css inside packs might be just "useless" now. But, It might pile up with time or you might even have your React src folder inside there which basically mean you will have webpacker compiling your app in a loop that might cause 40+ minutes when deploying (I learned the hard way 😅).