You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install the primer_view_components gem and @primer/view-components packages
gem install rails
rails -v
=> Rails 7.2.1
rails new test_app -d postgresql -j bun --skip-active-record --skip-active-storage -a propshaft -T --force
bundle add primer_view_components # ~> 0.34 version
bun add @primer/view-components # ^0.34.0 version
bun add @primer/css ^21.3.6 version
bun add @primer/primitives ^9.1.2 version
Add the following lines to the very bottom of config/application.rb:
Add your node_modules/ directory to Propshaft's load path by adding the following line to config/application.rb:
config.assets.paths << Rails.root.join("node_modules")
My file:
# application.rbrequire_relative"boot"require"rails"# Pick the frameworks you want:# require "active_model/railtie"require"active_job/railtie"# require "active_record/railtie"# require "active_storage/engine"require"action_controller/railtie"require"action_mailer/railtie"# require "action_mailbox/engine"# require "action_text/engine"require"action_view/railtie"require"action_cable/engine"# require "rails/test_unit/railtie"require"view_component"require"primer/view_components"require"primer/view_components/engine"# Require the gems listed in Gemfile, including any gems# you've limited to :test, :development, or :production.Bundler.require(*Rails.groups)moduleNextexaminerclassApplication < Rails::Application# Initialize configuration defaults for originally generated Rails version.config.load_defaults7.2# Please, add to the `ignore` list any other `lib` subdirectories that do# not contain `.rb` files, or that should not be reloaded or eager loaded.# Common ones are `templates`, `generators`, or `middleware`, for example.config.autoload_lib(ignore: %w[assetstasks])# Configuration for the application, engines, and railties goes here.## These settings can be overridden in specific environments using the files# in config/environments, which are processed later.## config.time_zone = "Central Time (US & Canada)"# config.eager_load_paths << Rails.root.join("extras")# Don't generate system test files.config.generators.system_tests=nil# Load node_modulesconfig.assets.paths << Rails.root.join("node_modules")endend
Add the following inside the tags in app/views/layouts/application.html.erb. These lines request primer_view_component's JavaScript code, shared CSS styles from @primer/css, primer_view_component's CSS styles, and a bunch of CSS variables from @primer/primitives. Notice we're also pulling in several color themes named "light" and "dark." The full list of supported themes is available in the Primer CSS documentation.
Hey @AlexeyMatskevich, sorry you're running into this! I just created a new Rails app following the steps you provided, and I am unable to reproduce the issue. I pushed up the app, can you take a look and see if this works on your machine? https://github.com/camertron/vc_test_app
Can't reproduce the installation from https://primer.style/guides/rails
Add the following lines to the very bottom of config/application.rb:
Add your node_modules/ directory to Propshaft's load path by adding the following line to config/application.rb:
config.assets.paths << Rails.root.join("node_modules")
My file:
Add the following inside the tags in app/views/layouts/application.html.erb. These lines request primer_view_component's JavaScript code, shared CSS styles from @primer/css, primer_view_component's CSS styles, and a bunch of CSS variables from @primer/primitives. Notice we're also pulling in several color themes named "light" and "dark." The full list of supported themes is available in the Primer CSS documentation.
My file:
My result:
I'm doing something wrong, can anyone help me deal with this?
The text was updated successfully, but these errors were encountered: