FEATURE: upgrade sprockets to latest stable

This unlocks Rails upgrades, so we can now upgrade to latest Rails
This commit is contained in:
Sam 2017-04-17 10:11:51 -04:00
parent c381086314
commit 6e5296a510
4 changed files with 22 additions and 3 deletions

View File

@ -358,10 +358,10 @@ GEM
spork-rails (4.0.0)
rails (>= 3.0.0, < 5)
spork (>= 1.0rc0)
sprockets (3.6.3)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.1.1)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)

View File

@ -1,3 +1,4 @@
require 'sprockets'
Sprockets.register_engine '.es6', Tilt::ES6ModuleTranspilerTemplate
Sprockets.register_mime_type 'application/ecmascript6', extensions: ['.es6', '.js.es6'], charset: :unicode
Sprockets.register_transformer 'application/ecmascript6', 'application/javascript', Tilt::ES6ModuleTranspilerTemplate

View File

@ -10,6 +10,15 @@ module Tilt
@mutex = Mutex.new
@ctx_init = Mutex.new
def self.call(input)
filename = input[:filename]
source = input[:data]
context = input[:environment].context_class.new(input)
result = new(filename){source}.render(context)
context.metadata.merge(data: result)
end
def prepare
# intentionally left empty
# Tilt requires this method to be defined

View File

@ -1,6 +1,15 @@
class SourceURL < Tilt::Template
self.default_mime_type = 'application/javascript'
def self.call(input)
filename = input[:filename]
source = input[:data]
context = input[:environment].context_class.new(input)
result = new(filename){source}.render(context)
context.metadata.merge(data: result)
end
def prepare
end