lucasmazza / spriteful

You know, sprites
Other
154 stars 13 forks source link

Support custom Stylesheet templates #18

Closed lucasmazza closed 10 years ago

lucasmazza commented 10 years ago

To let features like #12 and #16 without flooding the CLI with new options, I'm thinking of adding support for custom ERB stylesheet templates so users can do whatever they want do to with some ruby and an ERB file, like this:

$ spriteful image/icons -t templates/spriteful.css.erb

The template scope would have the Spriteful::Sprite instance and the bunch of helper methods that Spriteful::Stylesheet has for the template stuff.

Also would be epic to have a spriteful template [-f FORMAT] subcommand to copy one of the existing templates to the user cwd as a starting point to hack around with custom template - it would be a great time to expand this API if there is any other method that could be useful for custom templates and improve the test coverage of this stuff.

TODO

/cc @rafaelfranca @fnando @eshiota

Closes #12, #16 and #17.

rafaelfranca commented 10 years ago

I like the idea. And the generator would help to users know which options we will have.

fnando commented 10 years ago

What a coincidence... I was going to implement custom templates this noon. O_O

Nando Vieira

On May 22, 2014, at 10:16 AM, Lucas Mazza notifications@github.com wrote:

To let features like #12 and #16 without flooding the CLI with new options, I'm thinking of adding support for custom ERB stylesheet templates so users can do whatever they want do to with some ruby and an ERB file, like this:

$ spriteful image/icons -t templates/spriteful.css.erb The template scope would have the Spriteful::Sprite instance and the bunch of helper methods that Spriteful::Stylesheet has for the template stuff.

Also would be epic to have a spriteful template [-f FORMAT] subcommand to copy one of the existing templates to the user cwd as a starting point to hack around with custom template - it would be a great time to expand this API if there is any other method that could be useful for custom templates and improve the test coverage of this stuff.

/cc @rafaelfranca @fnando @eshiota

— Reply to this email directly or view it on GitHub.

lucasmazza commented 10 years ago

@fnando this means that you and @eshiota will do all the work? :P

eshiota commented 10 years ago

I won't mind if @fnando does all the work. :)

fnando commented 10 years ago

@eshiota you did it already on #19, right? :)

lucasmazza commented 10 years ago

@rafaelfranca the shitty side is that looks like I'll need some serious hacking on top of Thor to support the subcommand along the existing Thor::Group usage.

rafaelfranca commented 10 years ago

:bomb: The only way to make thor works without hacks is create different Thor for each command

lucasmazza commented 10 years ago

@rafaelfranca I hacked through Thor::Group.dispatch on 37e4300d4f039b9ac30225505c45598a32e8ecb4, that is part of the protected API. The only downside is that the help output has no information about the template task.

lucasmazza commented 10 years ago

I've released 0.3.0.beta1 for you folks to try it out while I refine the existing docs.