sprockets.rb 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. require 'sprockets/version'
  2. module Sprockets
  3. # Environment
  4. autoload :Base, "sprockets/base"
  5. autoload :Engines, "sprockets/engines"
  6. autoload :Environment, "sprockets/environment"
  7. autoload :Index, "sprockets/index"
  8. # Assets
  9. autoload :Asset, "sprockets/asset"
  10. autoload :BundledAsset, "sprockets/bundled_asset"
  11. autoload :ProcessedAsset, "sprockets/processed_asset"
  12. autoload :StaticAsset, "sprockets/static_asset"
  13. # Processing
  14. autoload :CharsetNormalizer, "sprockets/charset_normalizer"
  15. autoload :Context, "sprockets/context"
  16. autoload :DirectiveProcessor, "sprockets/directive_processor"
  17. autoload :EcoTemplate, "sprockets/eco_template"
  18. autoload :EjsTemplate, "sprockets/ejs_template"
  19. autoload :JstProcessor, "sprockets/jst_processor"
  20. autoload :Processor, "sprockets/processor"
  21. autoload :SafetyColons, "sprockets/safety_colons"
  22. # Internal utilities
  23. autoload :ArgumentError, "sprockets/errors"
  24. autoload :AssetAttributes, "sprockets/asset_attributes"
  25. autoload :CircularDependencyError, "sprockets/errors"
  26. autoload :ContentTypeMismatch, "sprockets/errors"
  27. autoload :EngineError, "sprockets/errors"
  28. autoload :Error, "sprockets/errors"
  29. autoload :FileNotFound, "sprockets/errors"
  30. autoload :Utils, "sprockets/utils"
  31. module Cache
  32. autoload :FileStore, "sprockets/cache/file_store"
  33. end
  34. # Extend Sprockets module to provide global registry
  35. extend Engines
  36. @engines = {}
  37. # Cherry pick the default Tilt engines that make sense for
  38. # Sprockets. We don't need ones that only generate html like HAML.
  39. # Mmm, CoffeeScript
  40. register_engine '.coffee', Tilt::CoffeeScriptTemplate
  41. # JST engines
  42. register_engine '.jst', JstProcessor
  43. register_engine '.eco', EcoTemplate
  44. register_engine '.ejs', EjsTemplate
  45. # CSS engines
  46. register_engine '.less', Tilt::LessTemplate
  47. register_engine '.sass', Tilt::SassTemplate
  48. register_engine '.scss', Tilt::ScssTemplate
  49. # Other
  50. register_engine '.erb', Tilt::ERBTemplate
  51. register_engine '.str', Tilt::StringTemplate
  52. end