twitter-bootstrap-rails gem 工作流程

发布于 2025-01-01 21:59:57 字数 372 浏览 0 评论 0原文

如何在 Rails 3.2.1 应用程序中使用 twitter-bootstrap-rails gem?工作流程是怎样的?

做完之后:

rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]

接下来我该做什么?我是否只需将生成的代码复制并粘贴到我的视图中?我是否对每个视图都执行此操作?如果是这样,做法

rails g bootstrap:themed [RESOURCE_NAME] [LAYOUT] [options]

有何不同?

你们甚至使用轨道发电​​机吗?

谢谢

How do I use the twitter-bootstrap-rails gem in my Rails 3.2.1 app? What is the workflow?

After I do:

rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]

what do I do next? Do I just copy and paste the generated code into my view? Do I do this for every view? If so, how is doing

rails g bootstrap:themed [RESOURCE_NAME] [LAYOUT] [options]

any different?

Do you guys even use the rails generators?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

万人眼中万个我 2025-01-08 21:59:57

我是 twitter-bootstrap-rails gem 的作者。我将向您快速介绍如何安装和使用 twitter-bootstrap-rails。

红宝石堆栈;
(需要 Ruby 1.9.3、Rails 3.1 或 Rails 3.2。使用 RVM 开始)

将 gem 捆绑到 Gemfile 后:

gem 'twitter-bootstrap-rails'

bundle install

运行安装生成器

rails g bootstrap:install

(它将包括 Twitter Bootstrap 到您应用程序的资产管道)

运行布局生成器

rails g bootstrap:layout application fixed

(它将为您生成布局,默认情况下将生成 application.html.erb 和固定布局)

运行主题生成器(可选);

rails g scaffold post title:string description:text

(此步骤使用 Rails 生成器为您创建 CRUD 内容)

rake db:migrate

(迁移到数据库)

rails g bootstrap:themed posts

(“帖子”视图和表单的 Twitter Bootstrap 兼容样式)

此外还有详细的安装、使用和生成器、coffeescript 等文档。
https://github.com/seyhunak/twitter-bootstrap-rails

I'm the author of twitter-bootstrap-rails gem. I'll give you a quick walktrough to how to install and use twitter-bootstrap-rails.

Ruby stack;
(Ruby 1.9.3, Rails 3.1 or Rails 3.2 is required. Use RVM to get started)

After bundling gem to Gemfile by;

gem 'twitter-bootstrap-rails'

bundle install

Run install generator

rails g bootstrap:install

(it will includes Twitter Bootstrap to your app's asset pipeline)

Run layout generator

rails g bootstrap:layout application fixed

(it will generates layout for you, by default application.html.erb and fixed layout will generates)

Run themed generator (optional);

rails g scaffold post title:string description:text

(this step uses Rails generators to create CRUD stuff for you)

rake db:migrate

(migrating to database)

rails g bootstrap:themed posts

(Twitter Bootstrap compatible styling for your 'posts' views and form)

Also there is detailed documentation to install, usage and generators, coffeescript etc.
https://github.com/seyhunak/twitter-bootstrap-rails.

黑寡妇 2025-01-08 21:59:57

有一个 RailsCasts 教程是一个很好的起点:

http://railscasts.com/episodes /328-twitter-bootstrap-basics

There is a RailsCasts tutorial that is a great starting point:

http://railscasts.com/episodes/328-twitter-bootstrap-basics

烟若柳尘 2025-01-08 21:59:57

运行:

rails new APPLICATION -m anyfile.rb

anyfile.rb

gem "therubyracer"
gem "less-rails" 
gem "twitter-bootstrap-rails"


generate("scaffold", "Post title:string content:text")
rake("db:create")
rake("db:migrate")
generate("bootstrap:layout", "application fluid")
generate("bootstrap:install")
generate("bootstrap:themed", "posts")


git :init
git :add => "."
git :commit => "-m First commit!"

Run:

rails new APPLICATION -m anyfile.rb

anyfile.rb

gem "therubyracer"
gem "less-rails" 
gem "twitter-bootstrap-rails"


generate("scaffold", "Post title:string content:text")
rake("db:create")
rake("db:migrate")
generate("bootstrap:layout", "application fluid")
generate("bootstrap:install")
generate("bootstrap:themed", "posts")


git :init
git :add => "."
git :commit => "-m First commit!"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文