Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bindings for dart #136

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Add bindings for dart #136

wants to merge 11 commits into from

Conversation

m-haisham
Copy link

@m-haisham m-haisham commented Mar 6, 2023

This pull request adds Dart bindings to this library. The bindings will allow Dart to load and interact with the library using C-Interop.

I've also included an example file, example/minify_html_example.dart, in the example folder to demonstrate how to use your library with Dart.

TODO: Documentation

Run

Move into dart directory

cd dart

Run the following command to build and move the library to an accessible place

cargo build -r --manifest-path native/Cargo.toml && mv native/target/release/libminifyhtml.so .dart_tool/minifyhtml

Run the example

dart run example/minify_html_example.dart

@wilsonzlin
Copy link
Owner

This is looking great, thanks @m-haisham. Don't worry about the docs, I'll add those and do some more general package cleanup tasks myself once it's merged, including structuring the project, some minor reformatting, and setting up CI.

How will the native binary be distributed? It looks like we can publish to the official pub.dev, but does that allow for bundling binary files? Alternatively, we'll need a post-install script that downloads the appropriate binary for the platform.

dart/README.md Outdated Show resolved Hide resolved
dart/CHANGELOG.md Outdated Show resolved Hide resolved
@m-haisham
Copy link
Author

How will the native binary be distributed?

The easiest solution would be to have it download the appropriate library files for each platform during build

@m-haisham m-haisham marked this pull request as ready for review March 10, 2023 09:06
@GladisHosterXY
Copy link

Hello m-haisham,

Thank you for your contribution to the library by adding Dart bindings! It's great to see the community working together to improve the library.

The example file you included in the example folder is helpful and makes it easier for developers to use the library with Dart. However, as you mentioned, it would be great to have documentation to go along with the bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants