3/8/2024 0 Comments Make a custom minified js file![]() custom js file loaded In your browser console. Now execute rake assets:precompile This will pack your javascript code (including our custom file we just added) Now reload your page and you should see the message. I tried restarting ghost and restarting the VPS with no luck. < javascriptpacktag custom, data-turbolinks-track: reload > 3.They now raise the same GET net::ERR_ABORTED message. I thought it might have been a permission problem, but when I switched the theme back to what I used before, those custom JS scripts that worked before stopped working now. raised the 404 not found error just like all the other files I uploaded. So I knew the directory was correct.īut then the strange thing happened, when I renamed the file back to script.js, the browser couldn’t find it anymore. Now when I tried going to it stopped working. You should always optimize your statics because even if you feel your application is fast without minification, maybe a network latency for some users would be balanced by a minified code. Then I decided to check if the directory was correct, so I went to my VPS’ terminal, went to the folder where I uploaded the JS files and renamed the script.js file. A good byte is a byte never sent by the server. worked, while all the other file names just resulted in 404 not found. So I decided to test the URL with the script.js file that was there before I uploaded the others. Similar to Stone s answer, but for Windows/.NET developers: If you have Visual Studio and ReSharper - An easy alternative for formatting Javascript is: Open the file with Visual Studio Click on ReSharper > Tools > Cleanup Code (Ctrl+E, C) Select 'Default: Reformat code', and click OK Crack open a beer. ![]() When I loaded up my blog, the Chrome console shows error alerts for all of the files that I had uploaded with GET net::ERR_ABORTED. Under the /assets/js folder there was already a file called script.js plus the other ones that I’d added. Notes: Make sure that for the unminified version you change the output file name to library.js and for the minified so they do not overwrite each other. To build it minified run: NODEENVproduction webpack. I was changing my theme and I uploaded some custom JS files to the theme’s ZIP. And then to build it unminified run (while in the projects main directory): webpack.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |