Skip to content

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.

@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.

3 participants