Edited at

Bootstrap2からBootstrap3へのclass一括更新メモ

More than 3 years have passed since last update.

slimで作られたbootstrap2のプロジェクトをbootstrap3にアップデートしたのでメモ。

下記コマンド打って後はdiff見ながら更新。

参考: http://getbootstrap.com/migration/

思ったよりさくっとアップデート可能でした。だいぶフラット感増します。

find ./path/to/views -type f | xargs sed -i "" "s/\.row-fluid/\.row/g"

find ./path/to/views -type f | xargs sed -i "" "s/\.span/\.col-md-/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.offset/\.col-md-offset-/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.brand/\.navbar-brand/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.navbar\.nav/\.navbar-nav/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.nav-collapse/\.navbar-collapse/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.btn-navbar/\.navbar-btn/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.hero-unit/\.jumbotron/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.icon-/.glyphicon\.glyphicon-/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.btn/\.btn\.btn-default/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.btn-mini/\.btn-xs/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.btn-small/\.btn-sm/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.btn-large/\.btn-lg/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.alert-error/\.alert-danger/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.visible-phone/\.visible-xs/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.visible-tablet/\.visible-sm/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.visible-desktop/\.visible-md\.visible-lg/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.hidden-phone/\.hidden-xs/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.hidden-tablet/\.hidden-sm/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.hidden-desktop/\.hidden-md\.hidden-lg/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.input-block-lebel/\.form-control/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.control-group\.warning/\.form-group.has-warning/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.control-group\.error/\.form-group.has-error/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.control-group\.success/\.form-group.has-success/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.control-group/\.form-group/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.checkbox\.inline/\.checkbox-inline/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.radio\.inline/\.radio-inline/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.input-prepend/\.input-group/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.input-append/\.input-group/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.add-on/\.input-group-addon/g"
find ./path/to/views -type f | xargs sed -i "" "s/ul\.unstyled/\.list-unstyled/g"
find ./path/to/views -type f | xargs sed -i "" "s/ul\.inline/\.list-inline/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.muted/\.text-muted/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.label/\.label\.label-default/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.lebal-important/\.label-danger/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.text-error/\.text-danger/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.table.error/\.table.danger/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.bar/\.progress-bar/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.bar-/\.progress-bar-/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.accordion/\.panel-group/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.accordion-group/\.panel\.panel-default/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.accordion-heading/\.panel-heading/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.accordion-body/\.panel-collapse/g"
find ./path/to/views -type f | xargs sed -i "" "s/\.accordion-inner/\.panel-body/g"