Class: Spritely::Sprockets::Preprocessor
- Inherits:
-
Sprockets::DirectiveProcessor
- Object
- Sprockets::DirectiveProcessor
- Spritely::Sprockets::Preprocessor
- Defined in:
- lib/spritely/sprockets/preprocessor.rb
Overview
Converts Sprockets directives from this:
//= repeat arrow true
//= spacing arrow 10
//= position another-image right
//= spacing 5
To this:
{
global: { spacing: 5 },
images: {
'arrow' => { repeat: 'true', spacing: '10' },
'another-image' => { position: 'right', spacing: '5' }
}
}
Constant Summary collapse
- GLOBAL_DIRECTIVES =
%w(position spacing).freeze
- IMAGE_DIRECTIVES =
%w(repeat position spacing).freeze
Instance Method Summary collapse
Instance Method Details
#_call(input) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/spritely/sprockets/preprocessor.rb', line 25 def _call(input) @sprite_directives = { global: {}, images: {} } super.tap do input[:metadata][:sprite_directives] = @sprite_directives end end |