kriswallsmith / assetic

Asset Management for PHP
MIT License
3.75k stars 555 forks source link

Add Mangle Props on uglifyjs2 configuration #868

Open cybermak opened 6 years ago

cybermak commented 6 years ago
symfony/assetic-bundle/Resources/config/filters/uglifyjs2.xml:        

        <parameter key="assetic.filter.uglifyjs2.mangle">false</parameter>
        <parameter key="assetic.filter.uglifyjs2.mangle-props">false</parameter>

            <call method="setMangle"><argument>%assetic.filter.uglifyjs2.mangle%</argument></call>
            <call method="setMangleProps"><argument>%assetic.filter.uglifyjs2.mangle_props%</argument></call>

kriswallsmith/assetic/src/Assetic/Filter/UglifyJs2Filter.php:    

    private $mangle;
    private $mangleProps;

    public function setMangle($mangle)
    {
        $this->mangle = $mangle;
    }

    public function setMangleProps($mangleProps)
    {
        $this->mangleProps = $mangleProps;
    }

    public function filterDump(AssetInterface $asset)
    {

        ....

        if ($this->mangle) {
            $pb->add('--mangle');
        }

        if ($this->mangleProps) {
            $pb->add('--mangle-props');
        }

       ...
}
jamesanderson9182 commented 6 years ago

@cybermak I have created a pull request with your change.

The Travis builds no longer pass because this repository has become slightly out of date.

If you want to be able to use this, modify the following in your composer.json file which is my commit of the fork. If this ever gets merged in you should change it back to what you had previously. You may encounter an issue with composer telling you that this this does not satisfy your minimum stability, update your stability at your own risk.

James

"jamesanderson9182/assetic": "dev-master#d3a7827"