Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
default_mime_type can just be a class method
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Dec 19, 2013
1 parent d93b48f commit 743c1b1
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 12 deletions.
4 changes: 3 additions & 1 deletion lib/sprockets/closure_compressor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Sprockets
class ClosureCompressor < Template
self.default_mime_type = 'application/javascript'
def self.default_mime_type
'application/javascript'
end

def render(context)
require 'closure-compiler' unless defined? ::Closure::Compiler
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/coffee_script_template.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Sprockets
class CoffeeScriptTemplate < Template
self.default_mime_type = 'application/javascript'
def self.default_mime_type
'application/javascript'
end

def render(context)
require 'coffee_script' unless defined? ::CoffeeScript
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/jst_processor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Sprockets
class JstProcessor < Template
self.default_mime_type = 'application/javascript'
def self.default_mime_type
'application/javascript'
end

def self.default_namespace
'this.JST'
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/less_template.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Sprockets
class LessTemplate < Template
self.default_mime_type = 'text/css'
def self.default_mime_type
'text/css'
end

def render(context)
require 'less' unless defined? ::Less
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/sass_compressor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Sprockets
class SassCompressor < Template
self.default_mime_type = 'text/css'
def self.default_mime_type
'text/css'
end

def render(context)
require 'sass' unless defined? ::Sass::Engine
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/sass_template.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module Sprockets
# Also see `SassImporter` for more infomation.
class SassTemplate < Template
self.default_mime_type = 'text/css'
def self.default_mime_type
'text/css'
end

def syntax
:sass
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/scss_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

module Sprockets
class ScssTemplate < SassTemplate
self.default_mime_type = 'text/css'
def self.default_mime_type
'text/css'
end

def syntax
:scss
Expand Down
4 changes: 0 additions & 4 deletions lib/sprockets/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ module Sprockets
class Template
attr_reader :data

class << self
attr_accessor :default_mime_type
end

def initialize(file, &block)
@data = block.call(self)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/uglifier_compressor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Sprockets
class UglifierCompressor < Template
self.default_mime_type = 'application/javascript'
def self.default_mime_type
'application/javascript'
end

def render(context)
require 'uglifier' unless defined? ::Uglifier
Expand Down

0 comments on commit 743c1b1

Please sign in to comment.