How to serve JS/CSS/Images from CDN in Moodle - moodle

I was wondering how I can set up a CDN to serve static assets - JS/CSS/Image files of Moodle. Is there any plugin that can help? Or would I need to write it from scratch?

There are three ways to achieve it:
setup a global CDN variable and prepend it
define cdnURL variable at both the PHP level and JavaScript level
I keep all JavaScript, CSS, JQuery, images in a separate folder and use/link it inside my custom plugins or core Moodle files.

Related

Hugo deploy and delete not necessary files

I'm developing a new Hugo site and in this case I thought to create also a template so.I can use for future site.
Well in the template there are tons of vendor files and library because depending of the pages that the site will implement these library will be used. The problem is on the deploy. For example I use Line icons library that has a lot of .png files. (For example 200 files).
Well in the template I put all the files but could happen that in the site that implement this template I use only five icons. Is there a way that look around the final HTML and the usage of the icons and delete in the public folder the not necessary files?
Not directly.
You would need to add an utility script to your template, in order for any user implementing said template to be able to call this script on demand.
That script should then be able to:
analyze the HTML files generated in public_html
cleanup the icons accordingly

What to download to use MDC Web offline in a PWA?

I want to use MDC Web (https://material-components.github.io/material-components-web-catalog/#/) in a PWA offline.
What am I supposed to download? Where is the official documentation for that?
You can either follow the getting started guide to generate your own javascript and css files (So you can customise colour, shape etc) here. (This is the recommended way)
Or you can just download and copy the CDN JS & CSS files here (JS) and here (CSS)
The CDN versions only use the default colour and shape and you cant change it that much.

Reusing content of an external webpage in DITA-OT

I tried different method to include the content of an external webpage by url in dita files without success. Is it possible to do it? I can add references to my dita files:
<related-links>
<link href="http://example.com" format="html" scope="external"/>
</related-links>
however I am not able to ddisplay the content of the page in oXygen.
tl;dr: It depends on the external sources and on your publication targets. If you want to publish to PDF, your content needs to be available offline.
What do you exactly mean with content? You can use external sources, e.g. images, if you just publish to html5. Just use the image URL in the href. If you publish to pdf, it would not work. The DITA-OT does not download things for you. Most websites are dynamic, so content is not very static so it may not work as you might expect. Maybe the external website has an API to gather the data you need. Or maybe it would be safer to use the depend.preprocess.pre extension point to hook in an Ant Target to download the external sources via <get> or curl. Another approach would be dita-glass for on-the-fly conversion. But, it depends...

Some questions about the export of the template from a website and the import of it into another website

I have installed TYPO3 on my web server and it use the "Introduction Package" template.
The problem is that I have to work on another TYPO3 online website that use a custom template.
Can I obtain the template of the online website and use it on my local website? (to perform some test in local).
I saw that TYPO3 uses various templating systems and I do not know how this could affect the export\import operation. In Joomla or WP I simply take the template directory and then I copy it into the themes directory but I think that in TYPO3 this operation could be more complex.
The fastest way is to copy these directories:
fileadmin
uploads
typo3conf/ext
and the complete database, then you have "cloned" the original website locally. (assuming that the core stuff is loaded the default way, with symlinks)
Then you just need to edit the database connection stuff and maybe some paths for image magick and so on in the typo3conf/LocalConfiguration.php.

add a new plugins path to Qtwebkit

I am trying to extend the search paths that qtwebkit uses to search for plugins. Basically I'm creating a plugin that is designed using the QTBrowserPlugin class and I am trying to make my browser which is programmeed using QTwebKit to search for the plugin in a folder specified by me as I don't want the plugin to be stored in the Mozilla Firefox plugins directory or the standard plugins directories.
Is this possible, and can I make my browser only look in the directory that I've specified, skipping all the standard directories. Since the browser will only be used to view locaL html pages.
There does not seem to be a public method in QtWebKit for doing this.
If you're willing to build QtWebKit from source, you can add a method to QWebPage that calls PluginDatabase::setPluginDirectories() and PluginDatabase::refresh().
I believe you can set the environment variable QTWEBKIT_PLUGIN_PATH for this purpose.