Skip to content

Instantly share code, notes, and snippets.

@nybblr
Last active November 27, 2023 15:41
Show Gist options
  • Save nybblr/99f16afa33d71382a33b to your computer and use it in GitHub Desktop.
Save nybblr/99f16afa33d71382a33b to your computer and use it in GitHub Desktop.
Rails with Bower. Without bower-rails.

Checkout the blog post for the whole story.

Setup Bower and install components:

npm install -g bower
bower install

Before deploying to Heroku, switch to the multi buildpack:

heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-multi.git

Then deploy as usual!

{
"directory": "vendor/assets/components"
}
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-ruby
/vendor/assets/components
module MyApp
class Application < Rails::Application
# ...
config.assets.paths << Rails.root.join("vendor","assets","components")
end
end
{
"name": "my-app",
"dependencies": {
"jquery": "~2.1.0",
"jquery-ujs": "~1.0.1"
}
}
{
"name": "my-app",
"devDependencies": {
"bower": "latest"
},
"scripts": {
"postinstall": "./node_modules/bower/bin/bower install"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment