gem “easy-html-creator”

yes …we are web developer ….and sometimes not …and we are also: developer …we are lazy, right 😉

…so it was a good thing for Dennis and me to write simple server and generator in ruby, to have all the benefits from haml templating, sass css processor, coffee script generator and bootstrap

we call it easy-html-creator and packed it into a ruby gem 🙂

!!!
%html{lang: 'de'}
  %head
    = render_partial '_metadata'
    = stylesheet_link_tag 'http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css'
    = javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'
    = javascript_include_tag 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js'
    /[if lt IE 9]
      = javascript_include_tag 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js'
      = javascript_include_tag 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js'
      %script
        var ltie9 = true

  %body{class: body_class}
    = render_partial '_header'
    %h1
      we are so laaaazy
    .content-wrapper
      = yield
    = render_partial '_footer'
    = link_to 'it`s a gem now', 'http://hoefweb.nl/gem-now-v-1-0-0/', class: 'gem-link so-lazy'

…yes it is a simple stand alone server, you start with “startServer”, which is serving and generating your output files each time you request it from a browser

@import "bootstrap/variables"
@import "bootstrap/mixins"
@import "dev_root/shared/sass/css3"

$image-url: '../images'
$border-color: #dedede

input, textarea, a, object, embed, button, button:focus
  outline: 0

html, body
  margin: 0
  padding: 0
  height: 100%

.content-wrapper
    +transition(all, 0.3s)
    +make-row

…and ruby is very fast on its own …we added some loading magic for helper and public content and overrode some active_support methods …and that’s it

module ActivesupportOverride
  def stylesheet_link_tag(path, media='screen')
    '<link href="'+path_to_css(path)+'" media="'+media+'" rel="stylesheet" type="text/css" />'
  end

  def javascript_include_tag(path)
    '<script src="'+path_to_js(path)+'"></script>'
  end

  def path_to_css(path)
    return path if external_path?(path)
    "css/#{path}"
  end

  def path_to_js(path)
    return path if external_path? path
    "js/#{path}"
  end

  def path_to_image(path)
    return path if external_path? path
    "images/#{path}"
  end

  def external_path? path
    path.start_with?('//') || path.start_with?('http')
  end
end

…now we are producing static html, css and javascript mostly the rails way …by having the performance of ruby 🙂

 

 

Bildschirmfoto 2014-11-10 um 22.09.00

contribute!