BirjuVachhani / spider

A small dart library to generate Assets dart code from assets folder.
https://spider.birju.dev/
Apache License 2.0
190 stars 19 forks source link

Files starting with a number not supported #47

Closed g123k closed 1 year ago

g123k commented 2 years ago

Hi everyone!

Thanks for this wonderful library.

I have a folder, with a few files starting with a number: eg (0-additives.svg, 1-additives.svg…). Instead of generating 0Additives, 1Additives…, Spider will instead just create Additives entries (the number is ignored).

It would be nice to support this use case.

BirjuVachhani commented 2 years ago

Hi @g123k

Thank you for reporting this issue.

The reason why this is not supported is because Dart doesn't allow variables/properties whose name starts with a number. It must be either an underscore(which would make it private) or an alphabet but it can't be a number.

You can rename your files to have numbers at the end. In that case, Spider will include them in code-gen.

Hope this helps. Let me know if you have anything else in mind.

g123k commented 2 years ago

Thanks a lot for your answer. What about prefixing this kind of file? And maybe make this one configurable?

BirjuVachhani commented 2 years ago

There's prefix configuration. But I don't remember whether that removes the prefix digits or not.

Can you try setting s prefix for this?

Check this out: https://birjuvachhani.github.io/spider/prefixes/

Let me know if this doesn't fix your issue.

BirjuVachhani commented 1 year ago

@g123k Closing this because of inactivity. Feel free to open again!