Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Template precompilation #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Assetfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,32 @@ distros = {
#MEGAHAX
ember_spade_postprocess = "filter EmberAddMicroLoader, :global => true"


instance_eval File.read(::EmberDev.support_path.join('Assetfile'))

require 'barber'
require 'rake-pipeline-web-filters'

# Helpers
ember_handlebars_template_name = Proc.new do |input|
template_dirs = input.path.split("/")[1..-2]
template_file_name = File.basename(input.path, File.extname(input.path))
template_dirs.push(template_file_name).join("/")
end

input "packages/ember-bootstrap/lib/templates/" do
match "*.hbs" do
handlebars wrapper_proc: Barber::Ember::FilePrecompiler,
key_name_proc: ember_handlebars_template_name
concat "modules/templates.js"
end
end

distros.each do |name, modules|
name = "ember-bootstrap"

input "dist/modules" do
module_paths = modules.map{|m| "#{m}.js" }
module_paths = modules.map{|m| "#{m}.js" } << "templates.js"
match "{#{module_paths.join(',')}}" do
concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
filter EmberAddMicroLoader
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source "http://rubygems.org"

gem "rake-pipeline", :git => "https://github.com/livingsocial/rake-pipeline.git"
gem "ember-dev", :git => "https://github.com/emberjs/ember-dev.git", :branch => 'master'
gem 'barber', :git => "https://github.com/tchak/barber.git"

gem 'ember-source', '1.0.0.rc6.2'

Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ GIT
rake (~> 10.0.0)
thor

GIT
remote: https://github.com/tchak/barber.git
revision: 6ebaeefaad44e16a1d6e47a8a126fe219f959457
specs:
barber (0.4.2)
ember-source
execjs
handlebars-source (>= 1.0.0.rc.4)

PATH
remote: .
specs:
Expand Down Expand Up @@ -79,6 +88,7 @@ PLATFORMS
ruby

DEPENDENCIES
barber!
ember-bootstrap-source!
ember-dev!
ember-source (= 1.0.0.rc6.2)
Expand Down
1 change: 1 addition & 0 deletions packages/ember-bootstrap/lib/templates/alert_message.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="close" rel="close" href="#">&times;</a>{{{view.message}}}
2 changes: 1 addition & 1 deletion packages/ember-bootstrap/lib/views/alert_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var get = Ember.get;
Bootstrap.AlertMessage = Ember.View.extend(Bootstrap.TypeSupport, {
classNames: ['alert', 'alert-message'],
baseClassName: 'alert',
template: Ember.Handlebars.compile('<a class="close" rel="close" href="#">&times;</a>{{{view.message}}}'),
templateName: 'alert_message',
message: null,
removeAfter: null,

Expand Down