-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #681
- Loading branch information
Showing
23 changed files
with
452 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'coffee_script' | ||
|
||
module Sprockets | ||
# Processor engine class for the CoffeeScript compiler. | ||
# Depends on the `coffee-script` and `coffee-script-source` gems. | ||
# | ||
# For more infomation see: | ||
# | ||
# https://github.com/josh/ruby-coffee-script | ||
# | ||
module CoffeeScriptProcessor | ||
VERSION = '1' | ||
SOURCE_VERSION = ::CoffeeScript::Source.version | ||
|
||
def self.call(input) | ||
data = input[:data] | ||
key = [self.name, SOURCE_VERSION, VERSION, data] | ||
input[:cache].fetch(key) do | ||
::CoffeeScript.compile(data) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,6 @@ | ||
require 'coffee_script' | ||
require 'sprockets/coffee_script_processor' | ||
|
||
module Sprockets | ||
# Template engine class for the CoffeeScript compiler. | ||
# Depends on the `coffee-script` and `coffee-script-source` gems. | ||
# | ||
# For more infomation see: | ||
# | ||
# https://github.com/josh/ruby-coffee-script | ||
# | ||
module CoffeeScriptTemplate | ||
VERSION = '1' | ||
SOURCE_VERSION = ::CoffeeScript::Source.version | ||
|
||
def self.call(input) | ||
data = input[:data] | ||
key = ['CoffeeScriptTemplate', SOURCE_VERSION, VERSION, data] | ||
input[:cache].fetch(key) do | ||
::CoffeeScript.compile(data) | ||
end | ||
end | ||
end | ||
# Deprecated | ||
CoffeeScriptTemplate = CoffeeScriptProcessor | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'eco' | ||
|
||
module Sprockets | ||
# Processor engine class for the Eco compiler. Depends on the `eco` gem. | ||
# | ||
# For more infomation see: | ||
# | ||
# https://github.com/sstephenson/ruby-eco | ||
# https://github.com/sstephenson/eco | ||
# | ||
module EcoProcessor | ||
VERSION = '1' | ||
|
||
# Compile template data with Eco compiler. | ||
# | ||
# Returns a JS function definition String. The result should be | ||
# assigned to a JS variable. | ||
# | ||
# # => "function(...) {...}" | ||
# | ||
def self.call(input) | ||
data = input[:data] | ||
key = [self.name, ::Eco::Source::VERSION, VERSION, data] | ||
input[:cache].fetch(key) do | ||
::Eco.compile(data) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,6 @@ | ||
require 'eco' | ||
require 'sprockets/eco_processor' | ||
|
||
module Sprockets | ||
# Template engine class for the Eco compiler. Depends on the `eco` gem. | ||
# | ||
# For more infomation see: | ||
# | ||
# https://github.com/sstephenson/ruby-eco | ||
# https://github.com/sstephenson/eco | ||
# | ||
module EcoTemplate | ||
VERSION = '1' | ||
|
||
# Compile template data with Eco compiler. | ||
# | ||
# Returns a JS function definition String. The result should be | ||
# assigned to a JS variable. | ||
# | ||
# # => "function(...) {...}" | ||
# | ||
def self.call(input) | ||
data = input[:data] | ||
key = ['EcoTemplate', ::Eco::Source::VERSION, VERSION, data] | ||
input[:cache].fetch(key) do | ||
::Eco.compile(data) | ||
end | ||
end | ||
end | ||
# Deprecated | ||
EcoTemplate = EcoProcessor | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'ejs' | ||
|
||
module Sprockets | ||
# Processor engine class for the EJS compiler. Depends on the `ejs` gem. | ||
# | ||
# For more infomation see: | ||
# | ||
# https://github.com/sstephenson/ruby-ejs | ||
# | ||
module EjsProcessor | ||
VERSION = '1' | ||
|
||
# Compile template data with EJS compiler. | ||
# | ||
# Returns a JS function definition String. The result should be | ||
# assigned to a JS variable. | ||
# | ||
# # => "function(obj){...}" | ||
# | ||
def self.call(input) | ||
data = input[:data] | ||
key = [self.name, VERSION, data] | ||
input[:cache].fetch(key) do | ||
::EJS.compile(data) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,6 @@ | ||
require 'ejs' | ||
require 'sprockets/ejs_processor' | ||
|
||
module Sprockets | ||
# Template engine class for the EJS compiler. Depends on the `ejs` gem. | ||
# | ||
# For more infomation see: | ||
# | ||
# https://github.com/sstephenson/ruby-ejs | ||
# | ||
module EjsTemplate | ||
VERSION = '1' | ||
|
||
# Compile template data with EJS compiler. | ||
# | ||
# Returns a JS function definition String. The result should be | ||
# assigned to a JS variable. | ||
# | ||
# # => "function(obj){...}" | ||
# | ||
def self.call(input) | ||
data = input[:data] | ||
key = ['EjsTemplate', VERSION, data] | ||
input[:cache].fetch(key) do | ||
::EJS.compile(data) | ||
end | ||
end | ||
end | ||
# Deprecated | ||
EjsTemplate = EjsProcessor | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'erb' | ||
|
||
module Sprockets | ||
class ERBProcessor | ||
def self.call(input) | ||
new.call(input) | ||
end | ||
|
||
def initialize(&block) | ||
@block = block | ||
end | ||
|
||
def call(input) | ||
engine = ::ERB.new(input[:data], nil, '<>') | ||
context = input[:environment].context_class.new(input) | ||
klass = (class << context; self; end) | ||
klass.class_eval(&@block) if @block | ||
engine.def_method(klass, :_evaluate_template, input[:filename]) | ||
data = context._evaluate_template | ||
context.metadata.merge(data: data) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,6 @@ | ||
require 'erb' | ||
require 'sprockets/erb_processor' | ||
|
||
module Sprockets | ||
class ERBTemplate | ||
def self.call(input) | ||
new.call(input) | ||
end | ||
|
||
def initialize(&block) | ||
@block = block | ||
end | ||
|
||
def call(input) | ||
engine = ::ERB.new(input[:data], nil, '<>') | ||
context = input[:environment].context_class.new(input) | ||
klass = (class << context; self; end) | ||
klass.class_eval(&@block) if @block | ||
engine.def_method(klass, :_evaluate_template, input[:filename]) | ||
data = context._evaluate_template | ||
context.metadata.merge(data: data) | ||
end | ||
end | ||
# Deprecated | ||
ERBTemplate = ERBProcessor | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Deprecated: Require sprockets/sass_template instead | ||
require 'sprockets/sass_template' | ||
# Deprecated: Require sprockets/sass_processor instead | ||
require 'sprockets/sass_processor' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Deprecated: Require sprockets/sass_template instead | ||
require 'sprockets/sass_template' | ||
# Deprecated: Require sprockets/sass_processor instead | ||
require 'sprockets/sass_processor' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Deprecated: Require sprockets/sass_template instead | ||
require 'sprockets/sass_template' | ||
# Deprecated: Require sprockets/sass_processor instead | ||
require 'sprockets/sass_processor' |
Oops, something went wrong.