-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Include partials in NPM package for Tailwind config #8220
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8220 +/- ##
=======================================
Coverage 99.10% 99.10%
=======================================
Files 140 140
Lines 4018 4018
=======================================
Hits 3982 3982
Misses 36 36 ☔ View full report in Codecov by Sentry. |
Right now in order to work around this issue in my setup, I have copied all the views by running module.exports = {
content: [
'./node_modules/flowbite/dist/flowbite.js',
'./node_modules/@activeadmin/activeadmin/plugin.js',
'./app/admin/**/*.{arb,erb,html,rb}',
'./app/views/active_admin/**/*.{arb,erb,html,rb}',
'./app/views/layouts/active_admin.html.erb',
'./app/views/layouts/active_admin_logged_out.html.erb',
'./app/views/admin/**/*.{arb,erb,html,rb}',
'./app/javascript/**/*.js'
],
darkMode: 'class',
plugins: [require(`@activeadmin/activeadmin/plugin`)]
} Once all the required files have been published to npm, I could change the config to the following and remove all the files copied with the rake task that I don't intend on customizing: const activeAdminPath = './node_modules/@activeadmin/activeadmin'
module.exports = {
content: [
`${activeAdminPath}/vendor/javascript/flowbite.js`,
`${activeAdminPath}/plugin.js`,
`${activeAdminPath}/app/views/**/*.{arb,erb,html,rb}`,
'./app/admin/**/*.{arb,erb,html,rb}',
'./app/views/active_admin/**/*.{arb,erb,html,rb}',
'./app/views/admin/**/*.{arb,erb,html,rb}',
'./app/javascript/**/*.js'
],
darkMode: "class",
plugins: [
require(`@activeadmin/activeadmin/plugin`)
]
} |
Hi @hasghari, thank you. I would need to know why this is an issue in some build steps with more detail. Can you please provide info on what that system looks like and why it wouldn't have access to the Ruby gem? Would be worth including all the vendor JS files in the NPM package at least so we could do that separately while hashing out the rest. I just don't see/understand the need for the other changes. Thanks! |
@javierjulio My current setup deploys to Heroku using the One workaround for this that I found was using the If I had all the required files available in the npm package, then I would have no dependency on the gem for running |
For reference, although it impacts jsbundling-rails:
Eventually, that last change also made it's way into cssbundling-rails via rails/cssbundling-rails#125 which should address your issue here since the approach is for the standard asset pipeline. |
Unfortunately the environment variable to skip |
I've also tried to test this beta version with our current setup (shakapacker + tailwind). |
The current tailwind configuration depends on the presence of the ruby gem. This is not flexible for all build systems and processes. By publishing all the files referenced in the tailwind config to npm, we can remove this dependency so that a yarn or npm build can run independently.
@hasghari only conclusion I come to here is that the approach is flawed. I don't see why this would be necessary since in your case you need to be using cssbundling-rails as you need to precompile assets and serve them. This comes across as a workaround for Heroku that is specific to your setup but not what others on Heroku would need or want if using Node and Rails. I really don't think it's the answer for us to be putting the Ruby files in the NPM package to accommodate a workaround or optimization, whereas that seems intentional to me with Heroku. Sorry. |
@javierjulio I agree that including the view files feels odd but in my opinion it's a less flawed solution than the Tailwind configuration expecting the presence of the I actually don't need to be using |
@hasghari thank you. |
The current tailwind configuration depends on the presence of the ruby gem. This is not flexible for all build systems and processes. By publishing all the files referenced in the tailwind config to npm, we can remove this dependency so that a yarn or npm build can run independently.