How to properly use a Cloned theme in Wordpress - javascript

In a few words, we have this active theme called themename located in this folder :
/public_html/wp-content/ .. /themename-wp
At this point, I am interested to install and use the same theme (the default settings version) but not updating, over the existing folder which contain some modifications in so many different places inside the files.
Reading different resources about this procedure, I am not so sure if renaming the new copied theme file (being inactive in this phase) from themename-wp in newthemename-wp will maintain the new installed theme 100% functional;
I have this concern because, If we need to replace the theme folder name into the theme files too, we have a situation:
-I've searched for themename-wp name with Agent Ransack all the theme files and I've found only 2 .json files containing this text.
On the other hand,
-Searching for themename without -wp, which is the displayed name of the theme, there are about 60 files (.css, .js and mostly .php's) that contain this text.
The question is:
-Should I find and replace the theme name only where appears as themename-wp OR I need to make these changes in other files as well replacing themename with newthemename OR will be enough to rename the new copied theme file in newthemename and that's all?
Thank you,

Related

Webpack: Get list of chunks from inside javascript

I wanted to access the list of JS chunk files from within entry point Javascript file. Is their a way I can inject it to JS as an array?
Description:
For example, I have following JS files:
node_modules
moment.js
jquery.js
public
index.html
menu.html
src
shared.js
utils.js
main.js (dependent on shared.js & uses moment)
index.js (dependent on shared.js & uses moment + jquery)
menu.js (dependent on utils.js & uses moment + jquery)
Now in webpack config I have 3 entry points say main, index, menu. For index & menu, I have related html files and I use HtmlWebPack plugin to inject the chunk files which works well.
But "main" entry point doesn't have any html files and it would be used for some other reason. Here for this entrypoint also it creates multiple dependent chunks say for example (0.js, main.chunk.js, runtime-main.chunk.js).
So for me, from "index.js" file, I wanted to get the list of all the chunks related to "main" entrypoint as array so that I can use those chunks dynamically when the code is getting executed in the browser.
Sample "index.js":
// Currently I am hardcoding this list, which makes me manually update this list whenever I add some more additional dependent files to it.
// I wanted this file list to be populated automatically while the bundling happens so that I need not maintain this list manually.
const filesList = ['/runtime-main.chunk.js','/0.js','main.chunk.js'];
filesList.forEach(file =>{
// I will do something with this file path
});
Mine is a very specific usecase where I definetely need the list of file names dynamically instead of somehow statically loading it. I know I can make use of "webpack-manifest-plugin" which generates the required mapping information as json file which I can use dynamically. But I am looking for a solution where it can somehow injected the list as array itself while bundling the code. I am definetely sure this is possible as I could achieve something similar elsewhere.
Question 2:
For the same usecase above, is their a way I can bundle all the dependency of "main" entrypoint alone as a single file which basically would be "main.chunk.js" so that i can just use that file without need for an array of files.
In advance, thank you for all your answers!!

Google Apps Script that moves a file into a folder with the same name

I am EXTREMELY new to coding and really don't know where to start with this. I am trying to figure how to move about 1200 .pdf files into specific folders. I am trying to do the following:
Move File "AAA.12-17" into Folder "AAA"
Move File "BBB.12-17" into Folder "BBB"
Move File "CCC.12-17" into Folder "CCC" and so on.
I run a 1200 page .pdf report that I split into individual one page files, save, and move into the specific folders in my Drive.
I've been researching scripts that move files in Google drive but can't figure out how to move specific files into specific folders. I appreciate all the help I can get on this.
Thanks in advance.
Willie
Folders don't actually exist on a Google drive. Files are indentified by an id number. Then they are tagged or labelled with what we see as folder names. A file can have multiple tag/labels associated with it (and it can appear in multiple folders at once).
So to "move" a file to a "folder" - what you're really doing is deleting a label (old folder name), and adding a new one (new folder name).
There's a similar question that has been answered that you can look at:
moving-files-in-google-drive-using-google-script
Also see Google's documentation. Look at addFile and removeFile on this page:
https://developers.google.com/apps-script/reference/drive/folder

IDE that can refactor CSS and Javascript

I have an index.html file in directory XXX and other html files in various subdirs.
In XXX, I have also the usual dirs js, images, and css that contain the corresponding files.
Is there an IDE that would allow me to somewhat automatically refactor id and class names throughout the whole project, and also check whether files contained in the dirs js and css, and images in the images dir, and so on, are being used?

How to use commercial themes with meteor.js

I'm a newbie who's trying to build a meteor app, and I was looking to cut some time by using a commercial theme. Let's take this as an example:
http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?WT.ac=category_item&WT.seg_1=category_item&WT.z_author=keenthemes
I have two options:
1) Use the html to create meteor templates, using spacebars tags, etc.
But how would I implement the theme javascript? doesnt it comes in conflict with meteor?
2) Use angular.js, as the theme is provided in angular.js format other than plain html. But wouldnt this create conflicts? is this a better approach?
In general, what is the easiest and best way to use commercial themes with meteor?
I bought similar themes on wrapbootstrap. I think it is the same problem here. (for Angular theme I do not know, as it would be trickier I think to integrate it with bootstrap)
Generally with such themes, you have a lot of 3rd-part JS libraries. You have to get them.
First option, you find a similar packages on atmosphere and you can add it. (A lot of jQuery library are simply wrapped as packages).
Second option, there is no such package (you can make and add them, and it would help the community :)). You can import them on the page you need with a package like wait-on-lib
You can import the libraries where you need them only. But I think the first option is cleaner.
And you will probably have some custom.js for each different page you have in your template, you have to transfer this logic when you render a template. For example the custom.js for the index file in your template will be transformed in :
A template name index where you can put the HTML and
Template.index.rendered = function(){
/* your custom js */
}
For the CSS you can simply copy past the files in client/css (for example) the files will be loaded.
I do not know if I have been very clear, but I managed to integrate such themes in meteor project. And do not forget to remove unnecessary files, for example when you add the bootstrap package, you can remove the bootstrap css and js files integreted to your template.
P.S : You may have to search/remplace path in the css and js files from the templates to load some images for example. Put all such files (as images) in your public folder, where you want, but do not forget to rewrite the path in your css and js files.
For example if you bougth a template where they have folder like :
folder_css
folder_image
...
the path are written this way :
/* css files */
background-image: url(../folder_image/myimage.png);
But in a meteor project, all files in public folder are at the root of the project, so you can rewrite your path, with for example something like this :
/* css files */
background-image: url(img/myimage.png);
Rewrite path in JS files also and I think it should work.

How can I generate a path relative to a Javascript/jQuery file?

I have a CMS template that uses JavaScript/jQuery to insert an image onto the page. This works fine when I specify an explicit path to the image, but because I use the template on several sites, the path needs to be determined automatically.
Making things a little harder is the fact that the path to the template (and therefore the image I'm linking to) changes periodically with each revision to the template.
Here's the (extremely simple) relevant code at the moment - which technically works in the short term, but is not the solution I'm looking for:-
src = '../template_v1/images/pdf_small.png'
This correctly generates the base URL, but breaks as soon as the template version is incremented (and the path changed) to template_v2 or template_v3, for example.
The JavaScript/jQuery file (again, included with the template) is located at http://www.domain.com/template_v1/js/this_file.js - so with that in mind, I want to be able to automatically generate a path to the image relative to the location of the this_file.js file. If this were CSS this would be easy, as non-explicit paths are relative to the CSS file calling the path - but I don't know how to accomplish this with JavaScript/jQuery.
Thanks in advance for any tips.
Do you need to go up a folder at the start of the source? Would going from the current directory work and stay within the template folder entirely:
src = './images/pdf_small.png'

Categories