Giter VIP home page Giter VIP logo

Comments (3)

matthiasmullie avatar matthiasmullie commented on May 18, 2024

Hey @vladimmi

I've been thinking about it.
I definitely like the gzip idea, although I wouldn't do it as part of minify() function. How about creating a new method in Minify.php? Something along these lines:

public function gzip($path, $level = 9)
{
    $content = $this->execute($path);
    $content = gzencode($content, $level)

    // save to path
    if ($path !== null) {
        $this->save($content, $path);
    }

    return $content;
}

What do you think about this?

I also like the other idea, I'm just not really sure it belongs in minifier :p I'll think about that some more.

from minify.

vladimmi avatar vladimmi commented on May 18, 2024

How about creating a new method in Minify.php?

Sure, you are free to do it as you wish ๐Ÿ‘

I also like the other idea, I'm just not really sure it belongs in minifier :p

That's why I decided to ask before starting to make tests and PR :) Pretty similar to image embedding (make one bigger file instead of many small requests) but... Got some troubles while thinking about that idea:

  1. unlike CSS, such JS code doesn't work without minifier. So it becomes something like builder, not just minifier. Wasn't problem for my project but can be for others.
  2. that can be workarounded but needs some additional JS code. Like var template = Foo.load('path/to/file'); and use that call as directive to embed template. But used paths can be relative to script (which are impossible to resolve from browser, as I know) or relative to root (and we need to set some root path to find them in minifier, making usage harder)...

Maybe you'll have some inspiration and better ideas :)

from minify.

matthiasmullie avatar matthiasmullie commented on May 18, 2024

Just included gzip() method in 30a4592 - thanks for the idea!

I'm not going to go ahead with the other idea, for exactly the same reasons you already listed - haven't been able to come up with great solutions myself :)

from minify.

Related Issues (20)

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.