Git Product home page Git Product logo

min's Introduction

✳ AstroMin

Extremely fast and smartπŸ”Ή Minification of 🟠 HTML 🟑 JS πŸ”΅ CSS 🟣 SVG
Meticulously optimized for Speed πŸ₯‡ and Effectiveness πŸ… based on Rust πŸ¦€

Built with Astro GitHub Repo Stars NPM Package Version License: MIT Types Socket Badge

Feature Highlights ✨

  • ⚑ Performant parallel processing (+1k files/s)
  • πŸͺΆ Lighter build output (~25% smaller)
  • πŸ“¦ small packaged size (~30KB)

Feature Roadmap 🌱

  • HTML, CSS, JS, SVG
  • Files and inline Code
  • Static Site Minification

Note

astro-min focuses on compressing statically generated content and pre-rendered routes

  • Support SSR / Hybrid Rendering
  • Remove Comments from external CSS/JS

Getting started 🎯

Use your package manager of your choice

# NPM
npm run astro add astro-min

# Bun (known bug πŸ›)
#bun astro add astro-min

# PNPM
pnpm astro add astro-min

# Yarn
yarn astro add astro-min

Manual Installation πŸ§‘β€πŸ’»

  1. Install package astro-min

  2. Import and add to integrations list

//astro.config.mjs
import { defineConfig } from 'astro/config'
import min from 'astro-min'

export default defineConfig({
  integrations: [min()]
})

Options πŸ”§

//astro.config.mjs
import { defineConfig } from 'astro/config'
import minify from 'astro-min'

export default defineConfig({
  integrations: [
    minify({
      do_not_minify_doctype: false,
      ensure_spec_compliant_unquoted_attribute_values: false,
      keep_closing_tags: false,
      keep_comments: false,
      keep_html_and_head_opening_tags: false,
      keep_input_type_text_attr: false,
      keep_spaces_between_attributes: false,
      keep_ssi_comments: false,
      minify_css: false,
      minify_js: false,
      preserve_brace_template_syntax: false,
      preserve_chevron_percent_template_syntax: false,
      remove_bangs: false,
      remove_processing_instructions: false,
    })
  ]
})

Important

Use astro-min last in your integration list for the best optimization
Optional: but before astro-compressor and astro-compress for images only

//astro.config.mjs
import { defineConfig } from 'astro/config'
import compressor from 'astro-compressor'
import minify from 'astro-min'

export default defineConfig({
  integrations: [
    minify({
      // do_not_minify_doctype: false,
      // ensure_spec_compliant_unquoted_attribute_values: false,
      // keep_closing_tags: false,
      // keep_comments: false,
      // keep_html_and_head_opening_tags: false,
      // keep_input_type_text_attr: false,
      // keep_spaces_between_attributes: false,
      // keep_ssi_comments: false,
      // minify_css: false,
      // minify_js: false,
      // preserve_brace_template_syntax: false,
      // preserve_chevron_percent_template_syntax: false,
      // remove_bangs: false,
      // remove_processing_instructions: false,
    }),
    compress({
      CSS: false,
      HTML: false,
      Image: true,
      JavaScript: false,
      SVG: false
    }),
    compressor()
  ]
})

Development πŸ’»

Open in StackBlitz Open with CodeSandbox Open in GitHub Codespaces Open in Gitpod

Learn more πŸ”–

Versus πŸ…

  • astro-compress

    • 🐌 uses terser based on javascript
    • πŸ’€ lightningcss not yet implemented
  • astro-html-minify

    • 🐌 uses terser based on javascript

Colophon πŸ“ƒ

Build with modern FOSS πŸ’š and AI assistance πŸ€–

Next generation ✨ web development based on Rust πŸ¦€

Changelog πŸ“–

1.2.0 - πŸ›  Feat: Parallel processing
- ✨ Feat: Skip *.min.*
1.1.0 - πŸ› Fix: Auto install bug

Advanced Astro

min's People

Contributors

rayyannafees avatar rdwz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rayyannafees

min's Issues

Error Installing

Hey! Tried installing on npm run astro add astro-min, it came up with this error

Installing dependencies...

Command failed with exit code 1: npm install astro-min@^null
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^null" of package "astro-min@^null": Tags may not have any characters that encodeURIComponent encodes.

Script not working for x86_64-apple-darwin

I'm getting the following error when trying to install the package using yarn.

error Couldn't find package "@minify-html/[email protected]" required by "@minify-html/node@^0.15.0" on the "npm" registry

I'm using x86_64-apple-darwin. I tried using export TARGET=x86_64-apple-darwin but no luck. Thank you.

Inconsistent instruction

The package added to astro import min - the README use minify.
This should be unified as it create inconsistency

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.