Wordpress - enabling JS in local running instance - wordpress

I am relatively new to Wordpress.
I have two instances of Wordpress - one running on a server in prod, and the other the same exact copy that I've downloaded from the server, but running locally.
A problem I'm trying to figure out is - the one on the server is loading all the necessary JS files within the theme. However, my local running instance is only loading JS files outside the theme.
In addition, I've noticed in my local running instance - there's a no-js class added to the <html> tag, whereas this is missing in the prod instance. This leads me to believe there must be some sort of switch on the theme itself, or somewhere in the wordpress admin panel that enables or disables JS.
For some context, I'm using the minimal minimum theme: https://wordpress.org/themes/minimum-minimal/

I found out what was preventing the JS from loading - I forgot to include <?php wp_footer(); ?>
within the footer - which loads in all the remaining necessary JS, in particular if they've been imported with via wp_enqueue_script with in_footer arg set to true

Related

Dealing with redundant scripts inside different wordpress plugins

Lets take the fallowing example:
In my website i have two plugins: plugin1 and plugin2.
Both these plugins happen to use "Data Tables" so that means that the server hosting the Wordpress Website ends up with two copies of "DataTables" because each plugin has its own paths to enqueue the scripts and styles.
If i am the person developing both plugins how can I avoid copying "DataTables" twice on the server and make plugin1 and plugin2 independent from each other.
Conditionally include your code by placing inside a function_exists check:
if (!function_exists('DataTables')) {
// will only run if DataTables is not defined already
}

Custom Domain not loading CSS (Azure)

The custom domain I've been using (which is already linked to an App Service in Microsoft Azure Portal) is not loading the my current styles files (.css files). Actually, it's loading older versions of those files, which I didn't create (they've had been created previously by another employee).
Has someone experienced this same issue? If I go to the website created by the App Service, the .CSS loaded there is correct (the one I've created), but whenever I go to the custom domain linked with this website, the .CSS loaded is older.
Clearing the browser cache will work locally. However, other repeat visitors will have the same issue you are having. A global method would be to rename your CSS file. That will force the browser for repeat visitor's to load the new/ current CSS file.
ex. "style.css" --> "styles.css"
Rename the CSS file and don't forget to rename the meta link as well.
Try clearing browser cache memory. CSS files are often get cached in the browsers.

Laravel app serving resources that do not exist?

I am in the process of adding a Content Security Policy for a laravel application. While downloading external css and font styles to the local assets I have run into some odd template behavior.
I wanted to test that the paths to the newly downloaded libraries were correct, but when I change the name of files I downloaded and refresh, even with the browser cache disabled, it is still referencing the old location successfully. If you try to access the file in the old location directly by file path it fails (because it no longer exists).
Even more strangely, if I pull the code down to another computer and run it (I have not added the new libraries to git yet), the page still seems to think it correctly loaded that resource.
I tried clearing the following directories:
storage/framework/cache
storage/framework/sessions
storage/framework/views
and running the code again - on multiple computers, and it still reports that it is loading these files that are no longer there?
Does Laravel or commonly used front end frameworks with it store compiled templates somewhere else? I am completely perplexed...

Integrating JSPM workflow with Wordpress development

Im trying to adopt JSPM as my package manager for Wordpress development but im failing at loading the main app file.
This is usually done with
<script>
System.import('./app');
</script>
The problem im running into is that jspm fails to load this file, trying to load in context of the current browser path http://localhost:3000/shop/app.js instead of the file system context.
I've tried to adjust some of the jspm's configuration options but couldn't get it to work.
Can you point in the right direction here?
When running on file:/// URLs, you need to set your baseURL to the current path. This can be done with:
System.config({ baseURL: '.' });
Either in your configuration file or in the page itself. Note that when you load pages on different path levels, this baseURL path needs to be adjusted so it may be advisable to specify it in the page itself.

Display Error in Oracle Apex Application

I have exported my oracle apex application and install on another computer. I used css file written by me on my application and also i have change some settings in Theme that i have used for my application. I have exported and installed that css file and theme also. but when i run my application, it is not display correctly. it display only Texts and Images that i have used in application. Theme is missing. but my Login page is display correctly. because it is not using my Template. Login page using Login Template in oracle apex. after logged, when i browse other pages in my application, they are not displaying correctly. Theme is missing on those pages.
The issue is with my Template. but i have imported it in to apex application.
How could i solve this ?
UPDATED
When i open the Developer Tools in my browser(chrome), in Matched CSS Rules section in Elements Tab, display only user agent stylesheet. there is no my stylesheet.
Check your theme templates you changed and see if they are really correct and contain the reference to your custom stylesheet(s)
Check the output of a page you know should have the stylesheet reference
Where do you store the stylesheet? Workspace files, Application files, or simply in the "/i/" (#IMAGE_PREFIX#) folder?
if the latter: did you copy over your stylesheet and is it in the correct location? You say you imported the application to another computer, so you might have simply forgotten to copy over those files.
What is your Apex version ?
How do you load your CSS files ? They are stored on the server (accessible using the image prefix #IMAGE_PREFIX#), loaded into the database (accessible using #WORKSPACE_IMAGES#) or stored on an external server (accessible using the full URL) ?
When you say "install on another computer", you mean load your application into another apex installation right ? Then are you sure the server is configured as the other one (especially image prefix) ?
Have you checked that templates are the same in the two applications ?
Use the console in Chrome or Firefox to check if there are any errors on your page, such as CSS files that can't be loaded.

Resources