Git Product home page Git Product logo

minifier's Introduction

Minifier

Asset minification and versioning library for CodeIgniter 4.

PHPUnit PHPStan Deptrac Coverage Status

PHP CodeIgniter

Installation

composer require michalsn/minifier

Configuration

Run command:

php spark minify:publish

This command will copy a config file to your app namespace. Then you can adjust it to your needs. By default, file will be present in app/Config/Minifier.php.

You should define an array of files that you want to minify, ie:

public $js = [
    'all.min.js' => [
        'jquery-3.7.1.min.js', 'bootstrap-3.3.7.min.js', 'main.js',
    ]
];

// or / and

public $css = [
    'all.min.css' => [
        'bootstrap-3.3.7.min.css', 'font-awesome-4.7.0.min.css', 'main.css',
    ]
];

This way requesting for a all.min.js or all.min.css file will return a minified and combined version of all files in a given array.

Docs

Read the full documentation: https://michalsn.github.io/minifier/

minifier's People

Contributors

daycry avatar dependabot[bot] avatar michalsn avatar paul45 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minifier's Issues

Trying to redeclare class on command

PHP Fatal error:  Cannot declare class Michalsn\Minifier\Commands\MinifyAll, because the name is already in use in ......\app\ThirdParty\minifier\src\Commands\MinifyAll.php on line 7

[ErrorException]

Cannot declare class Michalsn\Minifier\Commands\MinifyAll, because the name is already in use

Did a manual installation, running php spark minify:publish

why use $dirMinJs and $dirMinCss make emptyFolder()

The new release is a good idea with $dirMinJs and $dirMinCss

but why use $dirMinJs and $dirMinCss make emptyFolder()

for me i have many minified files in my folder and i dont want delet all when one file is update

Class 'MatthiasMullie\Minify\JS' not found

After this command : php spark minify:all

I see this error:

Class 'MatthiasMullie\Minify\JS' not found

at APPPATH\ThirdParty\minifier\src\Adapters\Js\MinifyAdapter.php:19

Backtrace:
  1    APPPATH\ThirdParty\minifier\src\Minifier.php:420
       Michalsn\Minifier\Adapters\Js\MinifyAdapter()->__construct()

  2    APPPATH\ThirdParty\minifier\src\Minifier.php:139
       Michalsn\Minifier\Minifier()->deployJs()

  3    APPPATH\ThirdParty\minifier\src\Commands\MinifyAll.php:27
       Michalsn\Minifier\Minifier()->deploy()

  4    SYSTEMPATH\CLI\Commands.php:67
       Michalsn\Minifier\Commands\MinifyAll()->run()

  5    SYSTEMPATH\CLI\CommandRunner.php:71
       CodeIgniter\CLI\Commands()->run()

  6    SYSTEMPATH\CLI\CommandRunner.php:56
       CodeIgniter\CLI\CommandRunner()->index()

  7    SYSTEMPATH\CodeIgniter.php:924
       CodeIgniter\CLI\CommandRunner()->_remap()

  8    SYSTEMPATH\CodeIgniter.php:436
       CodeIgniter\CodeIgniter()->runController()

  9    SYSTEMPATH\CodeIgniter.php:336
       CodeIgniter\CodeIgniter()->handleRequest()

 10    SYSTEMPATH\CLI\Console.php:61
       CodeIgniter\CodeIgniter()->run()

 11    ROOTPATH\spark:65
       CodeIgniter\CLI\Console()->run()

This is my autoload:

	public $psr4 = [
		APP_NAMESPACE => APPPATH, // For custom app namespace
		'Config'      => APPPATH . 'Config',
		'App'         => APPPATH,
		'Michalsn\Minifier' => APPPATH . 'ThirdParty/minifier/src',
	];

Error in minify

It doesn't minify correctly, when I launch the minify command the response is as follows:

image

In main.min.css file

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.