Skip to content

Conversation

@kivanio
Copy link

@kivanio kivanio commented Mar 3, 2022

@Edouard-chin
Copy link
Member

I think the fix should be in rails/rails, deleting the assets.rb file when using propshaft is initially wrong. Now that Rails supports two asset pipeline out of the box (sprockets/propshaft) we basically need to handle those two cases:

  • When an application is using sprockets -> Delete all files specific to propshaft (there is none right now)
  • When an application is using propshaft -> Delete all files specific to sprockets (manifest.js I think is the only one)

The code generated in the assets.rb initializer is compatible with both propshaft and sprockets and there is no reason to delete it IMO.

@Edouard-chin
Copy link
Member

Giving this a second thought, it also make sense to check if the assets.rb file exists

<<~RUBY
Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font")
RUBY
end
Copy link
Member

@Edouard-chin Edouard-chin Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if it doesn't exist, we can do the same as below and output what to do ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is most correct to say:

something like:

Add Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font") to your entry point Assets file

or something like

Create config/initializers/assets.rb and add Add Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font") there

If it is second so we should create the file with correct content inside.
Right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about

Add Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font") in your assets configuration file (by convention in 'config/initializers/assets.rb')

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@viktorianer viktorianer May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why just not create this file config/initializers/assets.rb, if it not exists?

But, it is fixed with rails/rails#44615.

@kivanio
Copy link
Author

kivanio commented Mar 3, 2022

@Edouard-chin
I do not know how propshaft works so I assumed assets.rb was not necessary but if it is I think you are right.
It need to be fixed in both places.

@dhh
Copy link
Member

dhh commented Jun 18, 2022

Fixed via rails/rails#44615

@dhh dhh closed this Jun 18, 2022
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.

Rails new with both bootstrap and propshaft does not work

4 participants