Part 1
-Start with the most basic, create a new project:
Rails New Blog
-then modify source to https://ruby.taobao.com, add bootstrap gem to Gemfile:
Gem ' Twitter-bootstrap-rails '
There is no error executing the bundle install, but there is a hint:
Important:you need to add a JavaScript runtime to your gemfile on order for Bootstrap's less files to compile to CSS. EXECJS supports these runtimes:therubyracer-google V8 embedded within Rubytherubyrhino-mozilla Rhino embedded within jrubynode.jsapple javascriptcore-included with Mac OS xmicrosoft Window S Script Host (JScript) **********************************************
Look at the hint is missing a JS Runtime,ok, follow the prompts I installed Execjs
Gem Install Execjs
The EXECJS supported runtime is then added to the Gemfile:
Gem ' Therubyracer '
Again bundle install, no problem, access to localhost:3000, can be normal access!
Part 2
-Create homepage
Rails Generate Controller Blogs
Add the index method to the BLOGSCONTROLLER.RB in the Blogs subdirectory under the Controller directory
def indexend
Then create a Index.html.erb file under the Views directory, adding a line of HTML code
Finally, change the routes.rb file to add
Root to: ' Blogs#index '
Refresh localhost:3000 again to see the new homepage!
The complete process of building a personal blog with Rails + bootstrap