0x1881/minify

A package for automaticaly minifying CSS, SCSS and Javascript for Laravel

Maintainers

👁 0x1881

Package info

github.com/0x1881/minify

pkg:composer/0x1881/minify

Statistics

Installs: 24

Dependents: 0

Suggesters: 0

Stars: 2

1.0 2023-04-30 17:06 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT c1e102fb929d97e7290b8a2f474553d6b657b036

  • Mehmet Can <1881x0.woop@gmail.com>

javascriptcssJSsassscssminifylaravel5

This package is auto-updated.

Last update: 2026-06-05 15:17:43 UTC


README

A simple package to minify CSS/SCSS and Javascript on the fly without the need of tools like Laravel Vite, Mix or Webpack. It combines all stylesheet files or javascript files into a single, minified file with simple but effective cachebusting with filemtime().

Version 2 is a completely new package (forked version 2) and (version 1) using scssphp/scssphp and tedivm/jshrink. Because minify now replaces natxet/cssmin with scssphp it can now compile SASS/SCSS code too!

Installation

Begin by installing this package with composer.

composer require 0x1881/minify

Laravel installation

Publish the config file if the defaults doesn't suite your needs:

php artisan vendor:publish --provider="C4N\Minify\ServiceProvider"

Stylesheet

// app/views/hello.blade.php
<html>
 <head>
 ...
 {!! Minify::stylesheet(['lightbox.css', 'fonts.css', 'styles.css']) !!}
 </head>
 ...
</html>

Javascript

// app/views/hello.blade.php

<html>
 <body>
 ...
 {!! Minify::javascript(['lazyload.min.js', 'scripts.js']) !!}
 <!-- Or: -->
 {!! Minify::javascript(['https://cdn.jsdelivr.net/npm/vanilla-lazyload@12.4.0/dist/lazyload.min.js', 'scripts.js') !!}
 </body>
</html>

Config

See the config file at /config/minify.php

Thanks

@nickdekruijk