Skip to content

Commit

Permalink
rename to manganis (similar to a rusting catalyst)
Browse files Browse the repository at this point in the history
  • Loading branch information
ealmloff committed Aug 18, 2023
1 parent c5a6cf4 commit 57c7efa
Show file tree
Hide file tree
Showing 26 changed files with 150 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Environment:**
- Collect Assets version: [e.g. v0.17, `master`]
- Manganis version: [e.g. v0.17, `master`]
- Rust version: [e.g. 1.43.0, `nightly`]
- OS info: [e.g. MacOS]
- App platform: [e.g. `web`, `desktop`]
Expand Down
114 changes: 57 additions & 57 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
name = "collect-assets"
# Manganese is a rusting catalyst. Manganis makes it faster to collect rust assets (and has almost no google search results)
name = "manganis"
version = "0.1.0"
authors = ["Evan Almloff"]
edition = "2021"
Expand All @@ -12,7 +13,7 @@ keywords = ["assets"]
[lib]

[dependencies]
assets-macro = { path = "./macro" }
manganis-macro = { path = "./macro" }

[workspace]
members = ["macro", "common", "cli-support", "test-package", "test-package/test-package-dependency", "test-package/test-package-nested-dependency"]
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# Collect Assets
# Manganis

The Collect Assets allows you to submit assets to a build tool that supports collecting assets. It makes it easy to self-host assets that are distributed throughout your library. Collect Assets also handles optimizing, converting, and fetching assets.
The Manganis allows you to submit assets to a build tool that supports collecting assets. It makes it easy to self-host assets that are distributed throughout your library. Manganis also handles optimizing, converting, and fetching assets.

If you defined this in a component library:
```rust
const AVIF_ASSET: &str = collect_assets::file!("./rustacean-flat-gesture.png");
const AVIF_ASSET: &str = manganis::file!("./rustacean-flat-gesture.png");
```

AVIF_ASSET will be set to a new file name that will be served by some CLI. That file can be collected by any package that depends on the component library.

```rust
// You can include tailwind classes that will be collected into the final binary
const TAILWIND_CLASSES: &str = collect_assets::classes!("flex flex-col p-5");
const TAILWIND_CLASSES: &str = manganis::classes!("flex flex-col p-5");

// You can also collect arbitrary files. Relative paths are resolved relative to the package root
const _: &str = collect_assets::file!("./src/asset.txt");
const _: &str = manganis::file!("./src/asset.txt");
// You can use URLs to copy read the asset at build time
const _: &str = collect_assets::file!("https://rustacean.net/assets/rustacean-flat-happy.png");
const _: &str = manganis::file!("https://rustacean.net/assets/rustacean-flat-happy.png");

// You can collect images which will be automatically optimized
const _: &str = collect_assets::image!("./rustacean-flat-gesture.png");
const _: &str = manganis::image!("./rustacean-flat-gesture.png");
// Resize the image at compile time to make the assets smaller
const _: &str = collect_assets::image!("./rustacean-flat-gesture.png", { size: (52, 52) });
const _: &str = manganis::image!("./rustacean-flat-gesture.png", { size: (52, 52) });
// Or convert the image at compile time to a web friendly format
const _: &str = collect_assets::image!("./rustacean-flat-gesture.png", { format: avif, size: (52, 52) });
const _: &str = manganis::image!("./rustacean-flat-gesture.png", { format: avif, size: (52, 52) });

// You can also collect google fonts
const _: &str = collect_assets::font!({ families: ["Roboto"] });
const _: &str = manganis::font!({ families: ["Roboto"] });
// Specify weights for fonts to collect
const _: &str = collect_assets::font!({ families: ["Comfortaa"], weights: [300] });
const _: &str = manganis::font!({ families: ["Comfortaa"], weights: [300] });
// Or specific text to include fonts for only the characters used in that text
const _: &str = collect_assets::font!({ families: ["Roboto"], weights: [200], text: "light font" });
const _: &str = manganis::font!({ families: ["Roboto"], weights: [200], text: "light font" });
```

## Adding Support to Your CLI
Expand Down
6 changes: 3 additions & 3 deletions cli-support/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "assets-cli-support"
name = "manganis-cli-support"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
assets-common = { path = "../common" }
manganis-common = { path = "../common" }

serde = { version = "1.0.183", features = ["derive"] }
toml = "0.7.6"
Expand Down Expand Up @@ -42,4 +42,4 @@ log = "0.4.20"
default = []
avif = ["image/avif-encoder"]
webp = ["image/webp-encoder"]
html = ["assets-common/html"]
html = ["manganis-common/html"]
6 changes: 3 additions & 3 deletions cli-support/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Collect Assets CLI Support
# Manganis CLI Support

This crate provides utilities to collect assets that integrate with the collect assets macro. It makes it easy to integrate an asset collection and optimization system into a build tool.
This crate provides utilities to collect assets that integrate with the Manganis macro. It makes it easy to integrate an asset collection and optimization system into a build tool.

```rust
use assets_cli_support::AssetManifestExt;
use assets_common::{AssetManifest, Config};
use manganis_common::{AssetManifest, Config};

fn main() {
use std::process::Command;
Expand Down
2 changes: 1 addition & 1 deletion cli-support/examples/cli.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use assets_cli_support::AssetManifestExt;
use assets_common::{AssetManifest, Config};
use manganis_common::{AssetManifest, Config};

fn main() {
use std::process::Command;
Expand Down
2 changes: 1 addition & 1 deletion cli-support/src/file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use assets_common::{CssOptions, FileAsset, FileLocation, FileOptions, ImageOptions, ImageType};
use manganis_common::{CssOptions, FileAsset, FileLocation, FileOptions, ImageOptions, ImageType};
use image::{DynamicImage, EncodableLayout};
use lightningcss::stylesheet::{MinifyOptions, ParserOptions, PrinterOptions, StyleSheet};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion cli-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ mod file;
mod manifest;
mod tailwind;

pub use assets_common::*;
pub use manganis_common::*;
pub use manifest::*;
pub use tailwind::*;
2 changes: 1 addition & 1 deletion cli-support/src/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use railwind::warning::Warning as TailwindWarning;
use std::path::{Path, PathBuf};

use assets_common::{
use manganis_common::{
cache::asset_cache_dir, cache::package_identifier, AssetManifest, AssetType, PackageAssets,
};
use cargo_lock::{
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "assets-common"
name = "manganis-common"
version = "0.1.0"
edition = "2021"

Expand Down
4 changes: 2 additions & 2 deletions macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "assets-macro"
name = "manganis-macro"
version = "0.0.1"
authors = ["Evan Almloff"]
edition = "2021"
Expand All @@ -16,4 +16,4 @@ proc-macro = true
proc-macro2 = { version = "1.0" }
quote = "1.0"
syn = { version = "2.0", features = ["full", "extra-traits"] }
assets-common = { path = "../common" }
manganis-common = { path = "../common" }
6 changes: 3 additions & 3 deletions macro/src/file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use assets_common::FileAsset;
use manganis_common::FileAsset;
use quote::{quote, ToTokens};
use syn::parse::Parse;

Expand All @@ -23,9 +23,9 @@ impl Parse for FileAssetParser {
let asset = FileAsset::new(path);
match asset {
Ok( this_file) => {
let asset = add_asset(assets_common::AssetType::File(this_file.clone()));
let asset = add_asset(manganis_common::AssetType::File(this_file.clone()));
let this_file = match asset {
assets_common::AssetType::File(this_file) => this_file,
manganis_common::AssetType::File(this_file) => this_file,
_ => unreachable!(),
};
let file_name= this_file.served_location();
Expand Down
8 changes: 4 additions & 4 deletions macro/src/font.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use assets_common::{CssOptions, FileAsset, FileSource};
use manganis_common::{CssOptions, FileAsset, FileSource};
use quote::{quote, ToTokens};
use syn::{braced, bracketed, parse::Parse};

Expand Down Expand Up @@ -155,13 +155,13 @@ impl Parse for FontAssetParser {
};
let asset = FileAsset::new_with_options(
url.clone(),
assets_common::FileOptions::Css(CssOptions::default()),
manganis_common::FileOptions::Css(CssOptions::default()),
);
match asset {
Ok( this_file) => {
let asset = add_asset(assets_common::AssetType::File(this_file.clone()));
let asset = add_asset(manganis_common::AssetType::File(this_file.clone()));
let this_file = match asset {
assets_common::AssetType::File(this_file) => this_file,
manganis_common::AssetType::File(this_file) => this_file,
_ => unreachable!(),
};
let file_name = this_file.served_location();
Expand Down
Loading

0 comments on commit 57c7efa

Please sign in to comment.