Comments (11)
I was not able to reproduce this issue.
- What compression engine are you using (did you try to change it)?
- What is your PHP version?
- What CodeIgniter version are you using?
from codeigniter-minify.
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.
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.
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.
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.
Yes, my result file is empty but I am trying to do by your way as you explained and update you.
from codeigniter-minify.
$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.
Ok, I tested it out.
- "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.
- "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.
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.
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.
It's working fine... 👍 I used it for my project.
from codeigniter-minify.
Related Issues (20)
- Closurecompiler cache option HOT 1
- Using $config['base_url'] in config.php causes malformed URLs. HOT 1
- Minify converting domain to ip HOT 1
- No reconoce palabras de javascript
- no scan
- Assets from CDNs HOT 2
- Closurecompiler and jsminplus don't work HOT 2
- Minify CI4 HOT 3
- Change base_url to static_url HOT 1
- $config['js_file'] not working properly HOT 1
- Need to look in more than one file HOT 1
- Browser cache does not work with the library HOT 1
- The each() function is deprecated. This message will be suppressed on further calls
- Strip cache busting from filenames HOT 1
- Add versioning to simple output when disabled HOT 1
- change default ClosureCompiler to jsmin HOT 1
- Difficult to run every time HOT 2
- Should only throw error on deploy HOT 3
- Write files to tmp location first HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeigniter-minify.