Class: Lotus::Assets::Compiler Private
- Inherits:
-
Object
- Object
- Lotus::Assets::Compiler
- Defined in:
- lib/lotus/assets/compiler.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Assets compiler
It compiles assets that needs to be preprocessed (eg. Sass or ES6) into the destination directory.
Vanilla javascripts or stylesheets are just copied over.
Constant Summary collapse
- DEFAULT_PERMISSIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
0644
- COMPILE_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'*.*.*'.freeze
- EXTENSIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{'.js' => true, '.css' => true}.freeze
- SASS_CACHE_LOCATION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pathname(Lotus.respond_to?(:root) ? Lotus.root : Dir.pwd).join('tmp', 'sass-cache')
Class Method Summary collapse
-
.cache ⇒ Object
private
Assets cache.
-
.compile(configuration, name) ⇒ Object
private
Compile the given asset.
Instance Method Summary collapse
-
#compile ⇒ Object
private
Compile the asset.
-
#initialize(configuration, name) ⇒ Lotus::Assets::Compiler
constructor
private
Return a new instance.
Constructor Details
#initialize(configuration, name) ⇒ Lotus::Assets::Compiler
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a new instance
81 82 83 84 |
# File 'lib/lotus/assets/compiler.rb', line 81 def initialize(configuration, name) @configuration = configuration @name = Pathname.new(name) end |
Class Method Details
.cache ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Assets cache
66 67 68 |
# File 'lib/lotus/assets/compiler.rb', line 66 def self.cache @@cache ||= Assets::Cache.new end |
.compile(configuration, name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Compile the given asset
52 53 54 55 56 57 58 |
# File 'lib/lotus/assets/compiler.rb', line 52 def self.compile(configuration, name) return unless configuration.compile require 'tilt' require 'lotus/assets/cache' new(configuration, name).compile end |
Instance Method Details
#compile ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Compile the asset
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/lotus/assets/compiler.rb', line 93 def compile raise MissingAsset.new(@name, @configuration.sources) unless exist? return unless fresh? if compile? compile! else copy! end cache! end |