decioferreira / bootstrap-generators Goto Github PK
View Code? Open in Web Editor NEWBootstrap-generators provides Twitter Bootstrap generators for Rails
License: MIT License
Bootstrap-generators provides Twitter Bootstrap generators for Rails
License: MIT License
rake assets:precompile is un-successful with the following config in application.rb
config.assets.initialize_on_precompile = false
However, when it is true, the assets precompile works.
As heroku does not allow the option to be true, every time before pushing the assets have to locally precompiled and added to repo.
Is there any way-around to the error?
It should be a great time for starting Bootstrap v4-alpha branch now !
Hello, I've been happily using this gem to get off the ground with Rails + Bootstrap.
I've come across an issue where a button is 1 pixel too small in height. I think I've traced it down to a SASS configuration thing related to SASS Number Precision.
https://github.com/twbs/bootstrap-sass#sass-number-precision
I'm not fluent enough with Rails to understand how/where to monkeypatch this configuration change. If it's something that the gem could be conscious of during the bootstrap:install task (or wherever it needs to end up?), I think it would be relevant for all of your users.
If this is a simple configuration one-liner somewhere in config/ I'd love to know. I tried adding
::Sass::Script::Number.precision = [8, ::Sass::Script::Number.precision].max
to config/application.rb randomly, but it didn't do the trick. Probably because it's not what I needed to do ;)
Any tips are appreciated.
It's mostly a user error, but in the README it is recommended to use the -f flag. I just copied and pasted. It replaced my application layout. I haven't yet commit my project to git, so this was a pain.
Perhaps would be nice to take that out of the README or provide explaination prior to and give alternative? Like:
Get started:
rails generate bootstrap:install
OR to force replace current templates:
rails generate bootstrap:install -f
Thank you!
Asset Pipeline is great, and we all love it... but sometimes I find myself using Asset Pipeline for the main views of my app, and using bootstrap for the admin views.
In this scenario, the bootstrap css files may conflict with my other views.
I fixed this by installing the generator and removing everything except for the templates in the lib directory, but doing so manually was a chore.
It would be helpful to have an option to:
If you generate scaffolding for admin/users
some of the links in the views will be incorrect (missing the namespace). For example, the link to create a new user should look like new_admin_user_path
but the generator has new_user_path
.
Not all links are incorrect, but most are.
In the template some of the links are created like:
link_to edit_<%= singular_table_name %>_path
(does not include namespace)
While others are created like:
link_to <%= index_helper %>_path
(does include namespace)
Based on https://api.rubyonrails.org/classes/Rails/Generators/NamedBase.html; I think we can just use other helper methods, eg: show_helper
& edit_helper
in placed of singular_table_name. Tho, that will produce _url
style links as opposed to _path
style links like now.
I don't see any activity in a while, but if you haven't moved away from this project would you like a PR?
Brand new rails 5.0.0 app, add the following to Gemfile:
gem 'bootstrap-generators'
Bundle, and rails generate bootstrap:install -f
.
Generate a scaffold: rails g scaffold car make:string model:string year:integer price:decimal
Start up rails server, visit http://localhost:3000/cars.
Error:
ActionView::Template::Error (The `content_tag_for` method has been removed from Rails. To continue using it, add the `record_tag_helper` gem to your Gemfile:
gem 'record_tag_helper', '~> 1.0'
Adding the record_tag_helper line fixes the issue.
Maybe bootstrap-generators should add a runtime_dependency on record_tag_helper?
I have been using this gem in rails 3.X without a problem, but in Rails 4.1.X it didn't work any more.
I have had to add the following code in application.rb :
config.app_generators do |g|
g.templates.unshift File::expand_path('../templates', __FILE__)
end
https://github.com/bbatsov/ruby-style-guide
/ now
.form-group
= f.label :name, :class => "col-sm-2 control-label"
/ be great
.form-group
= f.label :name, class: 'col-sm-2 control-label'
Launching my server, I get the following output:
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :hint, :wrap_with => {:tag=>:span, :class=>:hint} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :error, :wrap_with => {:tag=>:span, :class=>:error} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :label, :wrap_with => {:class=>"control-label"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing a block to use is deprecated. Please use wrapper instead of use. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:50)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :error, :wrap_with => {:tag=>"span", :class=>"help-inline"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :hint, :wrap_with => {:tag=>"p", :class=>"help-block"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :label, :wrap_with => {:class=>"control-label"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :hint, :wrap_with => {:tag=>"span", :class=>"help-block"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing a block to use is deprecated. Please use wrapper instead of use. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:50)
17:36:34 DEPRECATION WARNING: Passing a block to use is deprecated. Please use wrapper instead of use. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:50)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :error, :wrap_with => {:tag=>"span", :class=>"help-inline"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :label, :wrap_with => {:class=>"control-label"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :hint, :wrap_with => {:tag=>"span", :class=>"help-block"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
17:36:34 DEPRECATION WARNING: Passing a block to use is deprecated. Please use wrapper instead of use. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:50)
17:36:34 DEPRECATION WARNING: Passing a block to use is deprecated. Please use wrapper instead of use. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:50)
17:36:34 DEPRECATION WARNING: Passing :tag, :class and others to use is deprecated. Please invoke b.use :error, :wrap_with => {:tag=>"span", :class=>"help-inline"} instead. (called from use at /Users/harris/.rvm/gems/ruby-1.9.3-p0-perf@SGA/bundler/gems/simple_form-48ea550009cc/lib/simple_form/wrappers/builder.rb:56)
I am not sure whether it is an issue but how can I install theme?
Now that the rc is out would be a good time to make it compatible. Currently it throws:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
bootstrap-generators (~> 2.3) ruby depends on
railties (~> 3.1) ruby
rails (= 4.0.0.rc1) ruby depends on
railties (4.0.0.rc1)
I'm using Ruby 2.1, Rails 4.0.2
Running the generate bootstrap:install throws an error, as described bellow:
rails generate bootstrap:install -f
/home/fotanus/.rvm/gems/ruby-2.1.0/gems/bootstrap-generators-3.0.2/lib/bootstrap-generators.rb:12:in `block in <class:Engine>': undefined method `root' for Bootstrap::Rails:Module (NoMethodError)
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/fotanus/code/wordpress_manager/config/environment.rb:5:in `<top (required)>'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I'm not quite sure why the error is happening, the offended line seems correct:
app.config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
Simply commenting it would not add the fonts to the path, and the command works.
Great gem!
When I precompile the asset: RAILS_ENV=production bundle exec rake assets:precompile, I get the error variable @baseLineHeight is undefined, gems/bootstrap-generators-2.0.1/vendor/assets/stylesheets/less/accordion.less
I was reading over this gem in the rubygems site:
https://rubygems.org/gems/bootstrap-generators
Documentation states that when you run a rails generate command such as one below:
rails generate scaffold post title body:text published:boolean
that is should generate bootstrap templates.
I assume that means it will add a corresponding sass file to the controller in the assets/stylesheets directory. But I see nothing bootstrap related after running the generate command.
What might I be missing?
See: rails/sprockets-rails#269
Regular expressions are no longer supported in Sprockets.
https://github.com/decioferreira/bootstrap-generators/blob/master/lib/bootstrap-generators.rb#L14
- app.config.assets.precompile << /\.(?:svg|eot|woff|woff2|ttf)$/
+ %w(eot svg ttf woff woff2).each do |ext|
+ app.config.assets.precompile << "bootstrap/glyphicons-halflings-regular.#{ext}"
+ end
This PR #52 seems to work for:
Rails 5.2.4.1
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin18]
I got the following output when doing the bootstrap install after bundle install.
# Twitter Bootstrap 3
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bootstrap-generators', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
rails generate bootstrap:install -f
/Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/bootstrap-generators-3.0.0.1/lib/bootstrap-generators.rb:12:in `block in <class:Engine>': undefined method `root' for Bootstrap::Rails:Module (NoMethodError)
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:180:in `each'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from /Users/harryng/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/harryng/Documents/workspace/rails/meetup/config/environment.rb:5:in `<top (required)>'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/application.rb:189:in `require'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
from /Users/harryng/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/commands.rb:45:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Hi,
Brand new app, just getting around to configuring it:
This is what I get when I try to run the install or even simply launching the server locally:
=> Booting Puma
=> Rails 4.0.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/Users/john/.rvm/gems/ruby-2.0.0-p247/bundler/gems/bootstrap-generators-0c3c24eb895c/lib/bootstrap-generators.rb:12:in `block in <class:Engine>': undefined method `root' for Bootstrap::Rails:Module (NoMethodError)
I wanted to disable turbolinks
so I took it out from the Gemfile
, I also took it out from the application.html.erb
file that is generated when you run rails new blog
but still when I ran rails generate bootstrap:install --template-engine=haml
I got data-turbolinks-track
references in the application.html.haml
file.
I hope there is a way to take these references out in the generator.
Lack of the function for non-responsive layout.
Official Bootstrap site shows the temporary solution for it.
http://getbootstrap.com/examples/non-responsive/
However, this couldn't solve the problem.
It may the fundamental issue of Bootstrap 3 isn't it ?
Using the version of simple forms that you have on the readme (the git one) it gives me this error.
rails g bootstrap:install --template-engine=haml
It try to overview some files, like lib/templates/haml/scaffold/_form.html.haml
but it try to change simple_form to form_for, bootstrap-generators do support to simple_form_for??
When are going to support the latest version of bootstrap v3 - 3.2.0?
Will be happy to see that.
Hi Décio.
I have a problem with not displaying the glyphicons..
gem 'rails', '4.0.0'
gem 'sass-rails', '> 4.0.0'> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '> 1.2'> 2.3'
gem 'bootstrap-generators', '
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
gem 'bootstrap-wysihtml5-rails'
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require bootstrap-wysihtml5
//= require bootstrap-wysihtml5/locales/de-DE
//= require_tree .
// Sprite icons path
// -------------------------
$iconSpritePath: "glyphicons-halflings.png" !default;
$iconWhiteSpritePath: "glyphicons-halflings-white.png" !default;
View:
http://www.rails-dev.de/posts/4/edit
Any idea ?
Greetings and thanks for your work.
It doesn't generate the CSS for the input active border-highlight color.
I mean that blue glow that shines when a normal control is focused.
I think it should take it from @linkColor...
In the application layout there is and example of navigation, but the "active" class on the Home navigational link should be dependent on url.
I have followed the steps in the README step by step, but when I type:
rails generate scaffold post title body:text published:boolean
I still get the old scaffolfing, with class="field"
instead class="form-group"
, even though the file lib/templates/erb/scaffold/_form.html.erb
looks alright. There is actually not one class="field"
inside my whole project folder, but I still get the other class.
What is going on???
Mixin core-span is missing argument $gridColumnWidth.
In new rails (3.2.8) project. Same issue in anjlab/bootstrap-rails#24
Thanks!
When I update to v.3.0 und cap deploy, I get these errors:
couldn't find file 'bootstrap-transition'
after commenting this out:
couldn't find file 'bootstrap-alert' etc.
then:
File to import not found or unreadable: responsive.
downgrade to 2.3 => all is fine..
Greetings
I saw this same issue was raised 10 months ago, then resolved in an older version of the gem.
My rails 3.2.16 app uses bootstrap-generators (3.1.1) and sass-rails (3.2.6) (I tried them both in and not in assets group, got same error when pushing to heroku).
My config/application.rb has config.assets.initialize_on_precompile = false
My production.rb has config.assets.compile = true
Runs great locally, scaffolding works fine etc, but push to Heroku fails:
File to import not found or unreadable: bootstrap.scss.
Load path: Sass::Rails::Importer(/tmp/build_ .... /app/assets/stylesheets/bootstrap-generators.scss)
I do not have a bootstrap_and_overrides stylesheet, just application.css.scss and bootstrap-generators.scss and bootstrap-variables.scss (which I also tried renaming to .css.scss just in case that was an issue)
I do not have an explicit copy of bootstrap.scss - I assume that is provided in the gem.
I originally used the gem v3.1.0, updating to gem v3.1.1 - still gives same error on Heroku.
fwiw, if I run locally: RAILS_ENV=production bundle exec rake assets:precompile
I get the same error.
I also remvoed the bootstrap-generators gem from Gemfile, ran bundle install, replaces it, ran bundle install again, just to see if that fixed a bad install, but it had no effect.
Any thoughts?
It would be nice if this gem played nice with bootstrap-sass, letting that gem be in charge of the bootstrap assets if it is present. As of bootstrap-sass 3.2, when both gems are installed, overriding variables no longer works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.