Skip to content

Commit

Permalink
Suggestions on how to convert to bootstrap3
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Dec 19, 2013
1 parent e7ffa74 commit d575f67
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions bootstrap3-conversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#CLI's
## Change control-group class to form-group
find . -name '*.tt' | xargs perl -pi -e 's/control-group/form-group/g;'
## Change span\d to col-sm-\d
find . -name '*.tt' | xargs perl -pi -e 's/class="span(\d+)/class="col-sm-$1/g;'
## Give submit buttons a default class of btn-primary
find . -name '*.tt' | xargs perl -pi -e 's/class="btn"/class="btn btn-primary"/g;'
## hidden input types need a class
find . -name '*.tt' | xargs perl -pi -e 's/type="hidden"/class="form-control" type="hidden"/g unless /class=/;'

#Manual's

## All pages with custom headers and footers should include the main header and footer to
## reduce copy/paste includes.

See var/init/views/account/{header,footer}_include.tt.

## form controls and input wrappers need individual width controls, for example
:1,$s/\<controls/col-sm-8
:1,$s/control-label/col-sm-4 control-label/

##Shortcuts

## Copy over /data/Wing/var/init/views/account/{footer,header}_include.tt /data/MyProject/views/account
## Restore any project customizations to the nav for account

##Handlebars

#Change the template script include
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js" type="text/javascript"></script>

#Convert the type on all templates
<script id="user_template" type="text/x-handlebars-template">
:1,$s/text="text\/html"/type="text\/x-handlebars-template"/

#Fix the template syntax
:'<,'>perldo s/\$\{(\w+)}/{{$1}}/g;

#Compile and cache the template inside a script tag
<script type="text/javascript">
var template = Handlebars.compile($('#user_template').html());

#Update the template usage line:
$('#users').append(template(data.result));

0 comments on commit d575f67

Please sign in to comment.