mirror of
https://github.com/noodlapp/noodl-docs.git
synced 2026-01-11 23:02:54 +01:00
Initial commit
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: Michael Cartner <32543275+michaelcartner@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: Change nodes at build time
|
||||
hide_title: true
|
||||
---
|
||||
|
||||
<head>
|
||||
<meta name="robots" content="noindex,nofollow,noarchive" />
|
||||
</head>
|
||||
|
||||
# Change nodes at build time
|
||||
|
||||
:::note
|
||||
|
||||
This is recommended to only use in 2.7.x.
|
||||
|
||||
If using it in 2.6.x, you will change the current project
|
||||
which will not be temporary during building.
|
||||
|
||||
:::
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
async onPreBuild(context) {
|
||||
// Get all the "Function" nodes
|
||||
const functionNodes = context.project.getNodesWithType('JavaScriptFunction');
|
||||
functionNodes.forEach((node) => {
|
||||
// Replace all "Hello World" to "Hello" in the scripts
|
||||
node.parameters.functionScript = node.parameters.functionScript
|
||||
.replace("Hello World", "Hello");
|
||||
});
|
||||
},
|
||||
};
|
||||
```
|
||||
Reference in New Issue
Block a user