{"id":15289045,"url":"https://github.com/dickdavis/utility_classes","last_synced_at":"2025-10-07T03:30:55.887Z","repository":{"id":40009552,"uuid":"435094990","full_name":"dickdavis/utility_classes","owner":"dickdavis","description":"Rails gem that facilitates the use of utility CSS frameworks.","archived":true,"fork":false,"pushed_at":"2023-10-08T15:05:10.000Z","size":57,"stargazers_count":6,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-12T05:52:24.595Z","etag":null,"topics":["rails","ruby","tailwind-css","utility-classes"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dickdavis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://buymeacoffee.com/d3d1rty"]}},"created_at":"2021-12-05T06:48:44.000Z","updated_at":"2023-10-08T15:05:54.000Z","dependencies_parsed_at":"2024-09-30T15:58:40.640Z","dependency_job_id":"56cc89e6-5dfe-42e9-a708-6d75f6279070","html_url":"https://github.com/dickdavis/utility_classes","commit_stats":null,"previous_names":["d3d1rty/utility_classes"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dickdavis/utility_classes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dickdavis%2Futility_classes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dickdavis%2Futility_classes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dickdavis%2Futility_classes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dickdavis%2Futility_classes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dickdavis","download_url":"https://codeload.github.com/dickdavis/utility_classes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dickdavis%2Futility_classes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278715508,"owners_count":26033296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","ruby","tailwind-css","utility-classes"],"created_at":"2024-09-30T15:58:38.566Z","updated_at":"2025-10-07T03:30:55.528Z","avatar_url":"https://github.com/dickdavis.png","language":"Ruby","funding_links":["https://buymeacoffee.com/d3d1rty"],"categories":[],"sub_categories":[],"readme":"# UtilityClasses\n\n**You probably should NOT use this gem. The preferred method for accomplishing something similar is to use the `@apply` directive instead (if using TailwindCSS.) This gem will no longer be receiving updates.**\n\nRails gem that facilitates the use of utility CSS frameworks.\n\nThis project was inspired by the [classy-yaml](https://github.com/Tonksthebear/classy-yaml) project.\n\n## Usage\n\nYou can easily define a base class list for a given type:\n\n```yaml\n# config/utility_classes.yml\n\nheading:\n  base: 'text-lg font-semibold text-center'\n```\n\nAnd then retrieve the class list in your code:\n\n```ruby\nUtilityClasses.for(:heading)\n# \"text-lg font-semibold text-center\"\n```\n\nYou can optionally define variants for each type:\n\n```yaml\n# config/utility_classes.yml\n\nheading:\n  base: 'font-semibold text-center'\n  variants:\n    normal: 'text-lg'\n    large: 'text-2xl'\n    xlarge: 'text-4xl'\n```\n\nAnd then retrieve the class list by passing the variant key:\n\n```ruby\nUtilityClasses.for(:heading, variant: :large)\n# \"font-semibold text-center text-2xl\"\n```\n\nThe returned string will contain the base classes with the variant classes appended.\n\nThe `config/utility_classes.yml` file will be loaded into memory the first time it is called and only be reloaded if changes are made to the file.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'utility_classes'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install utility_classes\n```\n\nRun the install generator to create a config file (`config/utility_classes.yml`):\n\n```bash\n$ bin/rails generate utility_classes:install\n```\n\nAdd your classes to the generated config file following the structure of the examples.\n\nIf you are using TailwindCSS, ensure that your configuration lists the  `utility_classes.yml` file.\n\n`webpacker` approach:\n\n```javascript\n// tailwind.config.js\n\nmodule.exports = {\n  purge: [\n    './app/**/**.html.erb',\n    './config/utility_classes.yml' // add this line\n  ],\n  theme: {},\n  variants: {},\n  plugins: [],\n}\n```\n\n`tailwindcss-rails` approach:\n\n```ruby\n# add to your `config/environments/production.rb` file\n\nconfig.assets.css_compressor = :purger\nconfig.assets.css_compressor = Tailwindcss::Compressor.new(\n  files_with_class_names: Rails.root.glob('app/views/**/*.*') + Rails.root.glob('config/utility_classes.yml')\n)\n```\n\n## Contributing\n\nContributions are welcome. Feel free to open a PR.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdickdavis%2Futility_classes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdickdavis%2Futility_classes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdickdavis%2Futility_classes/lists"}