twbs / bootstrap-rubygem

Bootstrap rubygem for Rails / Sprockets / Hanami / etc
https://rubygems.org/gems/bootstrap
MIT License
2.01k stars 447 forks source link

Rails default Dockerfile build failed after added bootstrap gem #277

Open Peredery opened 6 months ago

Peredery commented 6 months ago
  1. Create new project with importmap by default
    rails new test_app
    cd ../test_app
    ./bin/bundle add dartsass-rails
    ./bin/rails dartsass:install
  2. Check if build is ok docker build .

Now let's produce error:

  1. add bootstrap gem ./bin/bundle add bootstrap --git 'https://github.com/twbs/bootstrap-rubygem'
  2. build it docker build .

throw error:

 => ERROR [8/8] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile                                                                 1.3s
------                                                                                                                                         
 > [8/8] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile:                                                                            
1.256 bin/rails aborted!                                                                                                                       
1.256 ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

Installing node/etc is not the right solution because the main reason to use importmap is to drop the nodejs dependency. Any ideas on how to solve this?

glebm commented 6 months ago

Just like the error message says, you do need some execjs runtime. The particular runtime is up to you to specify. E.g. you can use Node or mini_racer.

https://github.com/ai/autoprefixer-rails#usage

Peredery commented 6 months ago

Just like the error message says, you do need some execjs runtime. The particular runtime is up to you to specify. E.g. you can use Node or mini_racer.

https://github.com/ai/autoprefixer-rails#usage

but what is the point of adding support for dartsass-rails if we are still with "nodejs"? The actual usage with importmaps is broken, we still need to install some js runtime as well

glebm commented 6 months ago

The Sass engine is orthogonal to autoprefixer. The previous Sass engine didn't use nodejs either (sassc is written in C++), it's autoprefixer that does.

Peredery commented 6 months ago

The Sass engine is orthogonal to autoprefixer. The previous Sass engine didn't use nodejs either (sassc is written in C++), it's autoprefixer that does.

I see, I didn't know that. But in any case it turns out that there is no sense in flow with importmaps? Why keep nodejs and importmaps together in the project?

glebm commented 6 months ago

I'm not sure what importmaps have to do with any of this

jnstq commented 4 months ago

I've also encountered this issue while trying to build the Dockerfile. Is there a way to make the autoprefixer gem optional?

Physium commented 2 months ago

I agree, this makes no sense at all. The whole point of going with the rails default importmap setup was the fact that we do not need to install a js related runtime like node anymore in order to run rails. autoprefixer dependency in bootstraps just defeats that purposes isnt it?

glebm commented 2 months ago

I'm considering making the autoprefixer-rails dependency optional in the next release. Please test #283.

Physium commented 2 months ago

@glebm are you able to give a quick run down why autoprefixer-rails as a dependency for bootstrap is required by rails app? so what happens if this is now something optional? I'm still new to this side of rails and just trying to understand how does this work. Greatly appreciate any form of information from you!

vicvega commented 2 weeks ago

Please test #283.

@glebm I tested #283 and it'ok: docker builds without problems, using boostrap from branch rm-autoprefixer (wihtout autoprefixer-rails). No nodejs

Peredery commented 5 days ago

Any news on release of https://github.com/twbs/bootstrap-rubygem/pull/283 ?