Hi all, I recently started using Sage and I am trying to edit the /assets/scripts/main.js file. Whatever I write in jQuery it has no effect. For example:
(function($) { $('.alert').on('click', function() { alert('hello'); })(jQuery);
Gulp command and external scripts loaded with Bower work well.There is something I understand regarding the use of this file? Thanks!
I assume you have an .alert
item to click? Maybe just use the alert without the onClick, to remove one more possible issue?
Are you running gulp, gulp watch or gulp --production?
Thanks, Tobyl… I’ve this item to click. I run gulp
, I tried also gulp scripts
thinking it was faster. Now I’m not using gulp watch
. I think everything is ok, with Gulp. In /dist/ I find the new files compiled.
If you examine the script in the browser’s dev tools, does the javascript file exist with your code in it? Any errors in the console?
TypeError: t.Outlayer is undefined . I think is an error of Masonry script.
Yeah, if you have an error in a vendor script you most likely won’t see your code run. Is Masonry installed via Bower?
Thank you Tobyl. Yes, Masonry was installed via Bower and I removed it from the bower.json file just now. Run gulp and now I can see the alert on my page. I’ll try to understand what’s the matter with Masonry. Thanks again.
Do what Austin suggested here, since Masonry’s Bower file is also set up strangely
You’re right @kalenjohnson I had to do the same with Flickity. For Masonry, however, it was not enough to correct the error. I needed to exclude some dependencies of this script from the manifest.json file as reported here Error when masonry installed with bower + gulp