Add javascript files to laravel mix

1 reply · opened Apr 3, 2019

EejadsolutionsApr 3, 2019

Hi, I'm Linking the Theme with Laravel and trying to add css,javascript files from theme to laravel Mix.
css files is working fine, but i'm facing a lot of issues with js espacially in functions,plugin js.

So i have two questions:
1- is there such a way to add these two file to laravel mix without having errors?
2- how to remove unnecessary code from them, Their size is larger than 3 M.B!!!

I attached screen of console messages
Regards.

SSemicolon WebSTAFFApr 4, 2019

Hello,

According to the issue, it appears that while the js/functions.js File is loaded correctly, the issue is with the js/plugins.js File. Either it could be missing or not added properly or the order of the JS Files are incorrect. Please make sure that none of the afore mentioned exists and the issue should be resolved.

Coming to size of the JS Files, you can delete anything you like from the js/plugins.js File and the js/functions.js File will detect it and not throw an error. However, if you would like to delete anything from the js/functions.js File, make sure that you also delete the Function Calls for the same. Example, if you delete the toggles: function() Function Block:

toggles: function(){
	var $toggle = $('.toggle');
	if( $toggle.length > 0 ) {
		$toggle.each( function(){
			var element = $(this),
				elementState = element.attr('data-state');

			if( elementState != 'open' ){
				element.children('.togglec').hide();
			} else {
				element.children('.togglet').addClass("toggleta");
			}

			element.children('.togglet').off( 'click' ).on( 'click', function(){
				$(this).toggleClass('toggleta').next('.togglec').slideToggle(300);
				return true;
			});
		});
	}
},

then make sure that you delete all the instances of this Function call: SEMICOLON.widget.toggles(); as well.

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard