ViewComponentLiquid
Use Liquid templates and components from within GitHub's ViewComponent and your Rails application.
TODO: Update docs below
Installation
Add this line to your application's Gemfile:
gem 'view_component_liquid'And then execute:
$ bundle
Or install it yourself as:
$ gem install view_component_liquid
Next, add this line below where you require view_component in config/application.rb:
require "view_component_liquid/engine"Usage
TODO: Write usage instructions here
Bridgetown Filters
$ bundle add bridgetown-core
Then create the file config/initializers/bridgetown.rb
require "bridgetown-core/filters"
Liquid::Template.register_filter Bridgetown::FiltersLoading shared components from a Bridgetown site
Example:
# config/initializers/bridgetown.rb
# Set the path to your Bridgetown folder relative to the Rails root
bridgetown_path = Rails.root.parent.join("bridgetown-site-repo")
# Load in Liquid components and any shared Bridgetown builders
components_path = bridgetown_path.join("src", "_components")
plugins_path = bridgetown_path.join("plugins", "shared_rails")
ActiveSupport::Dependencies.autoload_paths << components_path
ActiveSupport::Dependencies.autoload_paths << plugins_path
# Instantiate any shared builders
ActiveSupport.on_load(:action_controller) do
class SiteBuilder < Bridgetown::Builder; end
# Pass along a "fake" site object. If you'd to include config to pass to
# your builder, you can do t
TagsBuilder.new(
"TagsBuilder",
OpenStruct.new(config: {
rails: "included config!"
}.with_indifferent_access)
)
endDevelopment
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/whitefusionhq/view_component_liquid.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the View::Component::Liquid project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.