I have two websites and in one of them I have some scripts that I want to use on the second website, I don't want to copy the .js files to the other projects, because if I had some change on the .js file I will have to do the same thing twice.
I don't know how can I do it, I've already read something abou Virtual Path Provider, but it apparently doesn't work fine for me, the .js files are in sub-folders, and the VPP won't find it.
Could someone give me ideas about what I should do?
Related
I'm trying for a while now to create a PWA in Oracle APEX by following some instructions on http://vmorneau.me/apex-pwa-part4/, but I'm having no luck in certain parts.
I've installed the demo to test it and see what's wrong, but I'm having the same issues with the demo app, namely some important files not being detected/found when I run it. I thought I had configured something wrong previously, but this time it was supposed to work properly.
Example, I have the app.js inside the js directory in Apex:
When I run the app, I get these messages:
I tried checking the file path the same way I tried to see if the manifest.json file was in the proper root folder, and it couldn't be found:
This looks like a common problem I see on the forums, that doesn't relate to the PWA concept. You'll probably find the same thing if you tried to refer to static files loaded into the workspace.
See Morten's example regarding a fixing the configuration
https://ora-00001.blogspot.com/2016/12/apex-plugin-files-and-404-not-found-in-ords.html
Or placed your files in the middle tier, using /i/ (or preferrably a custom location /c/)
I do a lot of JavaScript development in WebStorm, the Jetbrains IDE, and I find myself requiring a lot of external .js files into my current JS file like below.
var page=require("../../../documents/doc.js");
It's easy to require these files if your project is small; but mine is large and spans across a maze of folders/directories and grows even larger as the development team adds to it.
It would be nice to have a plugin for WebStorm IDE which allows to maybe drag and drop the JS file and it automatically writes the require statement like so:
var page=require("../../../documents/doc.js");
Or maybe some way to right click on the .js file I'm trying to import and click require or import if that option exists in WebStorm?
Is there a plugin to achieve this? Hopefully you get what I'm looking for. Please do not suggest other IDEs, I'm mostly interested in a way to achieve this in WebStorm, the IDE by the company JetBrains.
Thanks
We are developing multiple Java EE applications (8 for the moment) that are all based on the same sort of code. However, all the apps are clearly separated as different projects in Eclipse, they all have their own folder on Windows Explorer, and they all have their own repo on the Git server.
The idea was to put the redundant code somewhere (another project named "core"), and use it on every apps automatically without having to recode the same thing 8 times.
For the Java part, we did a "link source" in each project, which create sort of a symlink inside Eclipse to the "core" project, and use the specified "core" package in Java source with no problem.
But it doesn't work so well for the JavaScript/CSS part. I have absolutely no clue about how to code my redundant JS/CSS onto the "core" project, and use it elsewhere without having to manually copy it each and every time I modify it.
I think you should look into git for a solution to your problem. After all you still want the js file to be included in every project, but be maintained in a seperate project (as far as I understand it). There ought to be some sort of submodules and/or commit-handles or whatever to solve this using git.
This is what the User Library functionality in the JavaScript Include Path properties of your project is for.
In continuation with the below post is there any way to take ahead the build.xml and add all the plugins such as table, save etc and compress it with the same build.xml file. Reason is to have one ant script file to compress all the files into one, not only the tinymce js files but also other project related files.
tinymce build script to compress all js files
I know the compressio is possible by declaring additional tinyMCE_GZ.init but why use two methods of the compression in same project. It would nice to have as described in above post using build.xml.
How does the plugin structure works it is possible to take everything in one file & still intantiate plugin, right now when I take out all the script tag from table plugin (i.e from table.htm) file I get javascript error even though the script tag is available into the parent html file from which table plugin is invoked..
I tried that, but i failed. I won't say it is impossible, but it will be pretty difficult to achieve. What i ended up doing is to use two compessing methods.
The documentation for tinymce notes that one can compress all the javascript and components (which I assume includes plugins) into a single file. They do note reasons why one might not want to that as well.
Compressing into a static file
It's also possible to simply concatenate the necessary components and some boilerplate code into a single .js file. However you will always have to recreate this file if you want to use other TinyMCE plugins, or you upgrade TinyMCE. You will also probably want to configure your webserver to compress javascript files.
But assuming one actually did want to do it, how does one actually go about it? Build.xml does does not provide an appropriate task it seems. At least when I tried it the plugins did not seem to be included when I loaded tiny_mce.js.
There are some really excellent command line tools for this, but you can also do this easily with just a text editor. The simplest way is to just open each file, copy the contents, and paste the contents into a single JS file ("everything-all-together.js", say). You'll need to make sure you paste the files into the single file in the same order you would've put the script tags into the HTML doc. Once you have all the files all together, you can use tools like JSXMin, YUI Compressor, or Google Closure. There are also some tools online that do this, like http://www.minifyjavascript.com/. You can paste in the uncompressed JS and copy back out the compressed JS. This makes the build process really cumbersome, but if you just need to do this once, that will get you there.
The best way to do this is to do it as a build step for the site. That means when you make changes to the JS files, you rebuild the compressed JS file to include the changes as well. This can be a cumbersome step if you're iterating quickly and changing files over and over again. You don't want to have to rebuild the compressed file with each save. You can solve this by setting up development and production modes of the site. When being loaded in development mode, the JS files aren't grouped together. When all the necessary changes are made, you'd rerun the build step to generate the single compressed JS file. To do the minification from the command line, you'd probably want to use Google Closure: https://developers.google.com/closure/compiler/. If you download the compiler app, you can do the following:
java -jar compiler.jar some-file.js some-other-file.js > compiled.js
That will generate a file called compiled.js that includes the contents of some-file.js and some-other-file.js in a minified format. You can specify as many files to compile as you need to. Actually, I'm selling Closure a bit short to say it's just minified. It's also extremely optimized code. Pretty much every site should be doing this to all of there JS all the time unless they're already doing something better.
I hope I'm getting you (and the tinymce docs) right, but this sounds a lot like combining JavaScript files on the server side. This means taking the contents of all of your JS files, putting them into one file and returning that one to the client.
Why would you do that? Well, this should be obvious, but.. you reduce the number of HTTP requests to your server, which is always a good thing.
How do you do that? There are many solutions out there for all server-side languages and frameworks, I suggest doing a Google search for "[your language] javascript minifier" or something similar.
Hope this helps.