Can I add a custom section to a .vue file - vue.js

I am using single file Vue components in my app. What I'd like to do is add a new section, . Then, at build time, compile all of these configs into a single config file.
Is there a simple way to do this?
Thanks,

It turns out this is possible using Custom Blocks.

Related

Where to install 3rd party scripts in Nuxt?

Im trying to upload static files(images and js) from "static" folder. And it works fine for index file and base route localhost:8000/, but if I go to the next route localhost:8000/reviews/master001 then static files disappears and I receive by route localhost:8000/reviews/js. And there is two things, first is how to remove prefix "reviews"?
I tried to use in nuxt.config.js
static: {
prefix: false
}
by documentation, but it does not work. Tried to use paths in nuxt.config like "../js", "#/static/js", "/js" - this one works for index file.
Also there are no any static files after I go through the router-link such it in nuxt documentation for path localhost:8000/reviews/master001.
Here there are.
And here there no any files.
As explained in the comments above, images should be in assets and static is only aimed for specific use cases, like exposing a publicly accessible .pdf file.
If you want to install and use jQuery properly into your Nuxt project, you can follow my answer here: https://stackoverflow.com/a/68414170/8816585
If you want to load a specific script and cannot do it in a more cleaner way (with NPM), you can also follow the instructions there: https://stackoverflow.com/a/67535277/8816585
Use this as a last resort tho and be aware that it will increase bundle size and loading time.

How to disable Nuxt.js automatic file based route generation in favor of a manually generated routes.js file?

As we may know, Nuxt.js generates its routes by default based on the file structure of the pages folder.
What I want to know is, how to use a file and put my routes by myself, manually, instead of have Nuxt.js generating them for me?
Why?
I want more control of my routes, more explicit code and less files on the project.
I think its more easy to setup route params defining them explicit into a routes.js file rather then setting them by adding files into the project.
Any idea of how to do that, like on a normal Vue App? Thanks.
You can use #nuxtjs/router for that https://www.npmjs.com/package/#nuxtjs/router
Another option is to enchance automatic routing with https://github.com/nuxt-community/router-extras-module

How to work with css and js files in moodle plugin

I need to develop a plugin for Moodle, and i need to have some js and css files in plugin. But i have the next problem - how to work with them from installed plugin? Of course, i can hardcode their path via to moodle structure, but it's a very dirty and bad way. Also, i know that i can place all js and css code inline, but i think that it's a bad decision too. Is there a built-in way to serve assets from plugin? I tried to find it in documentations, but found nothing.
Thanks
I assume you want to know how to include CSS and JS files into your plugin.
You can include a JS file via the command:
$PAGE->requires->js( /relative/path/your_script.js');
You can then call a JS function once the page has been downloaded with the command:
$PAGE->requires->js_init_call ( your_JS_function_name, array_of_parameters_here, bool: on DOM ready);
For example:
$PAGE->requires->js_init_call('init', array($USER->lang), true);
Be sure to make the $PAGE available with global $PAGE;, first.
Your CSS file can be named styles.css and put into the root folder of your plugin. The file will be automatically read by the system and included. It will take precedence over (will overwrite the settings of) the system CSS files. After that you will have to reload the theme caches.

ESAPI custom property files

Ok, so I've been researching ESAPI for awhile now and trying to determnine how to create custom ESAPI and validator.properties files that override those found in my ESAPI jar. How do I accomplish this? I know it looks in 4 places (reference: ESAPI properties file in Tomcat, ESAPI docs) when trying to load, obviously loading via the classpath works but it's loading the default property values. I can get my custom properties to load when I put them in my home directory but that isn't very helpful.
Is there a way to get ESAPI to load my custom properties files when they are in my main projects directory?
Did you try to use
-Dorg.owasp.esapi.resources=PATH_TO_FOLDER
JVM option?

Combine all my custom JS into one single file with dojo build

I'm having a hard time trying to set up dojo build in my project.
Basically, I have my js folder with all my custom widgets and components. I simply want to combine all javascript files form js folder into one single file.
dojo sources are located outside this folder. The structure looks similar to this:
/public
/prod
/dojo-1.9
/dijit
/dojo
/dojox
/js
myScript1.js
myScript2.js
Do you have any idea on how should I configure the package.json and profile.js? The documentation doesn't seem to help since all I am getting is an output folder with the same contents as the js folder (no javascript is merged).
You can start by reading this article:
https://dojotoolkit.org/reference-guide/1.10/build/simpleExample.html
It provides a simplified overview of dojo build system.
Additional there is dojo boilerplate with a sample of folder structure and profile.js configuration for quick start here:
https://github.com/csnover/dojo-boilerplate
I definitely suggest you to use the boilerplate as start for your project as it simplify a lot initial configurations.