Skip to content

Assets generator update#8208

Merged
javierjulio merged 9 commits into
masterfrom
assets-templates-update
Jan 5, 2024
Merged

Assets generator update#8208
javierjulio merged 9 commits into
masterfrom
assets-templates-update

Conversation

@javierjulio

@javierjulio javierjulio commented Jan 4, 2024

Copy link
Copy Markdown
Member

This updates the assets generator to only create the stylesheet file and our Tailwind config file. We now install cssbundling-rails and importmap-rails and run both their setup scripts as part of the local app generation process. This will mimic what we expect a host app to have in place. From there they (and our local app gen) just need to change/update the build:css package script to use our CSS and Tailwind files. If the host app isn't using Tailwind already, they can easily update this to be in the application.css file instead if they want.

This also improves our rails template file to use existing methods for adding a route or environment config file change. Also removes git as its unnecessary for the local app gen.

There doesn't seem to be a setting for cssbundling-rails with tailwind as this always uses tailwindcss-rails and seems by design. Since we want to install and setup importmap-rails anyway, we'll do the same with cssbundling-rails.
We don't need to install the gem since we pass the --javascript=importmap argument on generating the dev/test app already.
@javierjulio javierjulio self-assigned this Jan 4, 2024
@codecov

codecov Bot commented Jan 4, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c61dc76) 99.10% compared to head (eedaa4a) 99.10%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8208   +/-   ##
=======================================
  Coverage   99.10%   99.10%           
=======================================
  Files         140      140           
  Lines        4013     4013           
=======================================
  Hits         3977     3977           
  Misses         36       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@javierjulio javierjulio force-pushed the assets-templates-update branch from 148570c to 816d478 Compare January 5, 2024 00:47
We want to generate this with its own name and not assume the host app isn't using Tailwind already. If they aren't and only plan to for the admin, then its a simple change on their to rename this.

We don't need to include Procfile.dev or builds/.keep since the expectation is that the host app has installed and run the setup for both cssbundling-rails (tailwind) and importmap-rails.

The most a host app will have to do after running the assets generator, is just add update the build:css script in package.json with the ActiveAdmin specific Tailwind build.
This now happens when running the install/setup scripts for cssbundling-rails and importmap-rails so we'll include this update.
This is no longer needed as all we need to do and for users, is to add the activeadmin npm package and update the build:css command with the updated tailwind command for activeadmin CSS. For that we the `npm pkg set scripts` command.
These are no longer defined. See if removing the bundle/gemfile resolves the Rails 6.1 CI build failure as everything else is passing.
We don't need git here since the app is created within the tmp directory and already ignored. It also would be one less action to run and less output too.
@javierjulio javierjulio force-pushed the assets-templates-update branch from 816d478 to eedaa4a Compare January 5, 2024 00:58
@javierjulio javierjulio merged commit 3f68a77 into master Jan 5, 2024
@javierjulio javierjulio deleted the assets-templates-update branch January 5, 2024 01:09
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

Successfully merging this pull request may close these issues.

1 participant