Giter Club home page Giter Club logo

Comments (11)

michalsn avatar michalsn commented on August 22, 2024

I was not able to reproduce this issue.

  1. What compression engine are you using (did you try to change it)?
  2. What is your PHP version?
  3. What CodeIgniter version are you using?

from codeigniter-minify.

adeelmughal4u avatar adeelmughal4u commented on August 22, 2024

My php version is 7.2 and CI 3

CSS is working fine but JS not working... how I can change compression engine?

from codeigniter-minify.

michalsn avatar michalsn commented on August 22, 2024

Search for $config['compression_engine'] in application/config/minify.php file.

OR

Dynamically, in your code - before using deploy_js method: $this->minify->compression_engine['js'] = 'jsmin' (or jsminplus).

I'm not sure but closurecompiler engine may have some limitation for POST request. And it seems that you're trying to send a lot of data.

from codeigniter-minify.

adeelmughal4u avatar adeelmughal4u commented on August 22, 2024

Yes I am sending 6,7 files with a lot of code, should I compress it in 2, 3 files in chunks... BTW thanks a lot for helping 👍

from codeigniter-minify.

michalsn avatar michalsn commented on August 22, 2024

Does other compression engines fails too? Your result file is empty or not? You can try with: $this->minify->deploy_js(TRUE)

If this is happening only for closurecompiler (default) engine, I would test it by adding to js() method only one file and then another, and another... then you will see if this is a problem with too big request or is it something with your js files.

Files in chunks... You could create a groups of files by calling:
$this->minify->js($files_array, 'group_number_here')
and then deploy as usual. Every group will send separate request to closurecompiler.

from codeigniter-minify.

adeelmughal4u avatar adeelmughal4u commented on August 22, 2024

Yes, my result file is empty but I am trying to do by your way as you explained and update you.

from codeigniter-minify.

adeelmughal4u avatar adeelmughal4u commented on August 22, 2024

$this->minify->js($all_js,'v-1.0.0');
$this->minify->compression_engine['js'] = 'jsmin';
echo $this->minify->deploy_js(TRUE);

with above code file is generating and everything fine... but not working with "jsminplus"

from codeigniter-minify.

michalsn avatar michalsn commented on August 22, 2024

Ok, I tested it out.

  1. "jsminplus" don't handle new js syntax well, e.g. using "let" instead of "var" cause error - but we have info on the screen what is happening so I guess it's ok.
  2. "closurecompiler" fails silently when there is any error - but this one is fixed now (#59).

In your case almost every js file is already minified, so you can save some time and just skip compression for this files.

$this->minify->auto_names = TRUE;

// disable compression
$this->minify->compress = FALSE;
$no_compress = ['mmenu.min.js', 'tippy.all.min.js', 'simplebar.min.js', 'bootstrap-slider.min.js', 'bootstrap-select.min.js', 'clipboard.min.js', 'counterup.min.js', 'magnific-popup.min.js', 'slick.min.js'];
$this->minify->js($no_compress, 'merge');

echo $this->minify->deploy_js(FALSE, NULL, 'merge');

// enable compression
$this->minify->compress = TRUE;
$compress = ['snackbar.js', 'custom.js'];

$this->minify->js($compress, 'default');

echo $this->minify->deploy_js(FALSE, NULL, 'default');

from codeigniter-minify.

adeelmughal4u avatar adeelmughal4u commented on August 22, 2024

Yes, that's good.

but I have another suggestion, by using this compression, a new file generated right. and when we made any change in any of the css or js file... the compressed file is auto updated it which causing the website process slowdown while generating and loading new file.

Instead of generating new file each time when we made changes in file... there should be a version controlling system where from we can generate the new file by changing the version otherwise the old generated file should be used even if there is a new change in CSS file.

from codeigniter-minify.

michalsn avatar michalsn commented on August 22, 2024

Yes... good thought. Done (#60).

Replace auto names ($this->minify->auto_names = TRUE;) from my previous comment with:

$this->minify->versioning = TRUE;
$this->minify->deploy_on_change = FALSE;

and then create separate controller/method (e.g. assets/deploy), that will force assets deploy. Something like:

// Assets controller
public function deploy()
{
        $this->load->library('minify');

	// disable compression
	$this->minify->compress = FALSE;
	$no_compress = ['mmenu.min.js', 'tippy.all.min.js', 'simplebar.min.js', 'bootstrap-slider.min.js', 'bootstrap-select.min.js', 'clipboard.min.js', 'counterup.min.js', 'magnific-popup.min.js', 'slick.min.js'];
	$this->minify->js($no_compress, 'merge');

        // force deploy
	$this->minify->deploy_js(TRUE, NULL, 'merge');

	// enable compression
	$this->minify->compress = TRUE;
	$compress = ['snackbar.js', 'custom.js'];

	$this->minify->js($compress, 'default');

        // force deploy
	$this->minify->deploy_js(TRUE, NULL, 'default');
}

And call this every time you want to generate a new assets versions.

from codeigniter-minify.

adeelmughal4u avatar adeelmughal4u commented on August 22, 2024

It's working fine... 👍 I used it for my project.

from codeigniter-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.