Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

works but brakes lines before "class", "value" etc #128

Open
sil2 opened this issue Feb 21, 2019 · 3 comments
Open

works but brakes lines before "class", "value" etc #128

sil2 opened this issue Feb 21, 2019 · 3 comments

Comments

@sil2
Copy link

sil2 commented Feb 21, 2019

view-source example
`
screen shot 2019-02-21 at 10 01 04

Why? Should be all in one line with no brakes, no?

@yurik94
Copy link

yurik94 commented Apr 4, 2019

Same

@bramburn
Copy link
Contributor

the performance is minimal, does it still work?

@PoLaKoSz
Copy link

PoLaKoSz commented Aug 6, 2019

This is a bug in the external Minify_HTML library:
If You add this test to this class ...

<?php

namespace Minify\Test;

use Minify_HTML;

class MinifyHTMLTest extends TestCase
{
    public function test1() { }

    public function test2() { }

    public function tagProvider()
    {
        return [
            ['<label for="email"></label>'],
            ['<input type="hidden">'],
        ];
    }

    /**
     * @dataProvider tagProvider
     */
    public function testNoNewLineAfterOpenTagName($htmlTag)
    {
        $actual = Minify_HTML::minify($htmlTag, array(
            'cssMinifier' => array('Minify_CSSmin', 'minify'),
            'jsMinifier' => array('JSMin\\JSMin', 'minify'),
        ));

        $this->assertEquals($htmlTag, $actual);
    }
}

and change this line

$this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/iu', "$1\n$2", $this->_html);

to this:

$this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/iu', "$1 $2", $this->_html);

it will parse correctly (but probably something else will fail to work properly 😄 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants