How to minify JavaScript with js error
I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.
magento2
add a comment |
I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.
magento2
add a comment |
I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.
magento2
I have some code error due to upgrade in Magento 2 but my goal is to minify js. Till now I know that we can not minify js without correcting error of the code in magento but I want to know some trick some realy awesome trick to minify js even I have some issue in the code.
magento2
magento2
edited Sep 28 '18 at 12:26
Bare Feet
1,5591732
1,5591732
asked Sep 28 '18 at 3:31
Magento BugMagento Bug
1598
1598
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section
and redeploy static content
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
add a comment |
Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
.
In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:
bin/magento deploy:mode:set production --skip-compilation
Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:
bin/magento cache:clean
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
|
show 9 more comments
To merge JavaScript files in Magento 2:
Navigate to Admin panel > Stores > Configuration > Advanced > Developer
Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.
When complete, click Save Config.
If the above solution is not working for you due to some bugs or errors, I would try this gulp solution
Take a look at this: How to minify/optimise Javascript on Magento 2?
Although, I would strongly recommend fixing the error.
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244226%2fhow-to-minify-javascript-with-js-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section
and redeploy static content
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
add a comment |
I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section
and redeploy static content
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
add a comment |
I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section
and redeploy static content
I think all that you need is enable "Enable JavaScript Bundling" and "Minify JavaScript Files" options in system configuration on website level in System Configuration > ADVANCED > Developer > JavaScript Settings section
and redeploy static content
answered Sep 28 '18 at 12:16
Rv SinghRv Singh
657417
657417
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
add a comment |
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
add a comment |
Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
.
In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:
bin/magento deploy:mode:set production --skip-compilation
Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:
bin/magento cache:clean
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
|
show 9 more comments
Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
.
In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:
bin/magento deploy:mode:set production --skip-compilation
Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:
bin/magento cache:clean
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
|
show 9 more comments
Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
.
In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:
bin/magento deploy:mode:set production --skip-compilation
Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:
bin/magento cache:clean
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
Go to admin panel Stores -> Configuration -> Advanced -> Developer . You will find option to enable js minification, choose it to be Yes (This option will be visible only if your developer mode is enabled.)
.
In your Magento 2 ssh console run the below command to set production mode if it is not set, because minification works only in production mode:
bin/magento deploy:mode:set production --skip-compilation
Note: --skip-compilation command is not mandatory, use it if you want skip compilation, i would recommend you to not skip it. Then run the below commands:
bin/magento cache:clean
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
answered Sep 28 '18 at 12:17
Sourabh Kumar SharmaSourabh Kumar Sharma
665316
665316
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
|
show 9 more comments
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
sorry i think you dont understand the question or maybe i didnt explain it correctly . when i minify js in developer mode and after i switch to production mode then js is not minified because there is some error in the code .. i dont want to remove the error i want to minify it only .
– Magento Bug
Sep 28 '18 at 22:07
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
Please post your error message and file name in the question.
– Sourabh Kumar Sharma
Sep 29 '18 at 4:46
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
there is no way to minify js without debuging the error ?
– Magento Bug
Sep 29 '18 at 18:08
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
How can we help until you show us your error.
– Sourabh Kumar Sharma
Sep 29 '18 at 19:36
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
prntscr.com/l09ptk
– Magento Bug
Sep 29 '18 at 20:21
|
show 9 more comments
To merge JavaScript files in Magento 2:
Navigate to Admin panel > Stores > Configuration > Advanced > Developer
Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.
When complete, click Save Config.
If the above solution is not working for you due to some bugs or errors, I would try this gulp solution
Take a look at this: How to minify/optimise Javascript on Magento 2?
Although, I would strongly recommend fixing the error.
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
add a comment |
To merge JavaScript files in Magento 2:
Navigate to Admin panel > Stores > Configuration > Advanced > Developer
Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.
When complete, click Save Config.
If the above solution is not working for you due to some bugs or errors, I would try this gulp solution
Take a look at this: How to minify/optimise Javascript on Magento 2?
Although, I would strongly recommend fixing the error.
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
add a comment |
To merge JavaScript files in Magento 2:
Navigate to Admin panel > Stores > Configuration > Advanced > Developer
Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.
When complete, click Save Config.
If the above solution is not working for you due to some bugs or errors, I would try this gulp solution
Take a look at this: How to minify/optimise Javascript on Magento 2?
Although, I would strongly recommend fixing the error.
To merge JavaScript files in Magento 2:
Navigate to Admin panel > Stores > Configuration > Advanced > Developer
Open the JavaScript Settings section and in the Minify JavaScript Files field, select Yes.
When complete, click Save Config.
If the above solution is not working for you due to some bugs or errors, I would try this gulp solution
Take a look at this: How to minify/optimise Javascript on Magento 2?
Although, I would strongly recommend fixing the error.
edited 12 mins ago
Pang
10515
10515
answered Sep 28 '18 at 10:22
Bare FeetBare Feet
1,5591732
1,5591732
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
add a comment |
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
ok i will think about removing the error but for now i am trying to minify it . if nothing helped me out then will do something like that .
– Magento Bug
Sep 28 '18 at 22:09
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244226%2fhow-to-minify-javascript-with-js-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown