Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Rebuild gem #115

Merged
merged 9 commits into from
Jan 4, 2024
Merged

Rebuild gem #115

merged 9 commits into from
Jan 4, 2024

Conversation

jgarber623
Copy link
Owner

This PR strips back most of the gem's functionality with the intention of relaying the foundation and reimplementing the CLI's functionality in a modern, streamlined way (toward a v5 release). A goal is to do this in a manner that's not terribly disruptive from the CLI angle, but that opens up more possibilities for using the gem directly via Ruby code.

This PR is the first step in that direction. The most relevant commit (c66f1e5) tells the biggest part of the story:

Changes include:

  • completely refactored Ruby interface to the gem
  • vendor-ing (thanks, MIT License) Active Support's very helpful "blank"
    extension

Note that many of the deletions to the CLI commands will return later.
This change lays the groundwork for rebuilding those aspects of the
project by first reimplementing the Ruby code in a modern, streamlined
manner.

require "svgeez"

Svgeez.build_sprite_sheet(
  "./app/assets/icons",
  "./app/assets/build/icons.svg",
  prefix: "custom-prefix"
)

The above example is a shortcut to an instance of
Svgeez::SpriteSheetBuilder (and its #build_sprite_sheet) method. If
you want or need a bit more control, you can also:

require "svgeez"

sprite_sheet_builder = Svgeez::SpriteSheetBuilder.new(
  "./app/assets/icons",
  "./app/assets/build/icons.svg",
  prefix: "custom-prefix"
)

sprite_sheet_builder.sprite_sheet
sprite_sheet_builder.sprites

sprite_sheet_builder.build_sprite_sheet

Important

This is a work-in-progress! I expect to add more functionality in the coming days and to update the project's documentation. What's here could change quite a bit before we get to v5.0.0.

Thanks for sticking around. 😄

Changes include:

- completely refactored Ruby interface to the gem
- vendor-ing (thanks, MIT License) Active Support's very helpful "blank"
  extension

Note that many of the deletions to the CLI commands will return later.
This change lays the groundwork for rebuilding _those_ aspects of the
project by first reimplementing the Ruby code in a modern, streamlined
manner.

```ruby
require "svgeez"

Svgeez.build_sprite_sheet(
  "./app/assets/icons",
  "./app/assets/build/icons.svg",
  prefix: "custom-prefix"
)
```

The above example is a shortcut to an instance of
`Svgeez::SpriteSheetBuilder` (and its `#build_sprite_sheet`) method. If
you want or need a bit more control, you can also:

```ruby
require "svgeez"

sprite_sheet_builder = Svgeez::SpriteSheetBuilder.new(
  "./app/assets/icons",
  "./app/assets/build/icons.svg",
  prefix: "custom-prefix"
)

sprite_sheet_builder.sprite_sheet
sprite_sheet_builder.sprites

sprite_sheet_builder.build_sprite_sheet
```
As noted in a previous commit, this line of work is aimed at relaying
the project's foundation. Many of the deletions here will return in
one form or another when I can tackle the CLI interface.
@jgarber623 jgarber623 self-assigned this Jan 4, 2024
@jgarber623 jgarber623 merged commit 8ea683d into main Jan 4, 2024
9 checks passed
@jgarber623 jgarber623 deleted the rebuild-gem branch January 4, 2024 19:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant