mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-12-17 11:04:14 +00:00
larry babby and threejs for glsl
This commit is contained in:
85
webGl/my-threejs-test/node_modules/htmlnano/lib/modules/example.cjs
generated
vendored
Normal file
85
webGl/my-threejs-test/node_modules/htmlnano/lib/modules/example.cjs
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = example;
|
||||
exports.onAttrs = onAttrs;
|
||||
exports.onContent = onContent;
|
||||
exports.onNode = onNode;
|
||||
/**
|
||||
* It is an example htmlnano module.
|
||||
*
|
||||
* A htmlnano module can be modify the attributes of every node (through a "onAttrs" named export),
|
||||
* modify the content of every node (through an optional "onContent" named export), modify the node
|
||||
* itself (through an optional "onNode" named export), or modify the entire tree (through an optional
|
||||
* default export).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modify attributes of node. Optional.
|
||||
*
|
||||
* @param {object} options - Options that were passed to htmlnano
|
||||
* @param moduleOptions — Module options. For most modules this is just "true" (indication that the module was enabled)
|
||||
* @return {Function} - Return a function that takes attribute object and the node (for the context), and returns the modified attribute object
|
||||
*/
|
||||
function onAttrs(options, moduleOptions) {
|
||||
return (attrs, node) => {
|
||||
// You can modify "attrs" based on "node"
|
||||
const newAttrs = {
|
||||
...attrs
|
||||
};
|
||||
return newAttrs; // ... then return the modified attrs
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify content of node. Optional.
|
||||
*
|
||||
* @param {object} options - Options that were passed to htmlnano
|
||||
* @param moduleOptions — Module options. For most modules this is just "true" (indication that the module was enabled)
|
||||
* @return {Function} - Return a function that takes contents (an array of node and string) and the node (for the context), and returns the modified content array.
|
||||
*/
|
||||
function onContent(options, moduleOptions) {
|
||||
return (content, node) => {
|
||||
// Same goes the "content"
|
||||
|
||||
return content; // ... return modified content here
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* It is possible to modify entire ndde as well. Optional.
|
||||
* @param {object} options - Options that were passed to htmlnano
|
||||
* @param moduleOptions — Module options. For most modules this is just "true" (indication that the module was enabled)
|
||||
* @return {Function} - Return a function that takes the node, and returns the new, modified node.
|
||||
*/
|
||||
function onNode(options, moduleOptions) {
|
||||
return node => {
|
||||
return node; // ... return new node here
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the entire tree. Optional.
|
||||
*
|
||||
* @param {object} tree - PostHTML tree (https://github.com/posthtml/posthtml/blob/master/README.md)
|
||||
* @param {object} options - Options that were passed to htmlnano
|
||||
* @param moduleOptions — Module options. For most modules this is just "true" (indication that the module was enabled)
|
||||
* @return {object | Proimse} - Return the modified tree.
|
||||
*/
|
||||
function example(tree, options, moduleOptions) {
|
||||
// Module filename (example.es6), exported default function name (example),
|
||||
// and test filename (example.js) must be the same.
|
||||
|
||||
// You can traverse the tree...
|
||||
tree.walk(node => {
|
||||
// ...and make some minification
|
||||
});
|
||||
|
||||
// At the end you must return the tree
|
||||
return tree;
|
||||
|
||||
// Or a promise with the tree
|
||||
return somePromise.then(() => tree);
|
||||
}
|
||||
Reference in New Issue
Block a user