Note
This gem is only useful for projects without Node.js and asset bundling
Integrates Flowbite with the Ruby on Rails Asset Pipeline.
Works great with the following gems:
Add flowbite
to your Gemfile:
gem "flowbite", "~> 2.3"
You can pin either flowbite.esm.js
in config/importmap.rb
:
pin "flowbite", to: "flowbite.esm.js"
Tailwind CSS for Rails gem is wraps the standalone executable version of the Tailwind CSS framework, which means to add additional plugins you need to download the script to your server. To solve this problem, we wrote a rake task:
bin/rails flowbite:bundler:plugin
it's copy a plugin.js
to vendor/javascript/flowbite
folder. To start using it, just require flowbite as plugin inside the config/tailwind.config.js
file
module.exports = {
// ...
plugins: [
// ...
require("../vendor/javascript/flowbite/plugin.js")
]
// ...
}
This gem automatically registers flowbite.js
, flowbite-plugin.js
, flowbite.esm.js
, and flowbite.css
dependencies in your asset pipeline. Now you can use them in your project.
As a dependency through Sprockets, add the following code to your application.js
:
//= require flowbite
and application.css
:
/*
*= require flowbite
*/
... or by adding it to your template (also works with Propshaft):
<%= javascript_include_tag :flowbite %>
<%= stylesheet_link_tag :flowbite %>
Bug reports and pull requests are welcome on GitHub at https://github.com/iwdt/flowbite-rails.
- Fork it (https://github.com/iwdt/flowbite-rails/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Usefull scripts for development:
- Update flowbite deps:
bun update flowbite
- Build javascript:
bun build:js
- Build stylesheets:
bun build:css
- Build gem:
gem build
The gem is available as open source under the terms of the MIT License.