@total_onion/onion-library 3.0.24 → 3.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/createNewBlock.js
CHANGED
|
@@ -73,39 +73,11 @@ if (dynamicEntryPoints.indexOf(newBlockName) !== -1) {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const imageTemplate = `
|
|
77
|
-
{{ include("components/responsive-image.twig", {fields : fields, block : block, blockClassName: blockClassName}, with_context = false) }}
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
const contentContainerTemplate = `
|
|
81
|
-
<div class="${newBlockName}__content-container">
|
|
82
|
-
<h1 class="${newBlockName}__title">${newBlockName} title!</h1>
|
|
83
|
-
</div>
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
76
|
const templateData = `
|
|
87
77
|
{% set blockClassName = "${newBlockName}" %}
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
{% set styleEntryPoint = include('entry-points/entry-point-style.twig', { fields: fields, block: block, is_preview }, with_context = false) %}
|
|
92
|
-
{% set previewEntryPoint = include('entry-points/entry-point-preview-info.twig', { fields, block, displaytype, is_preview }, with_context = false) %}
|
|
93
|
-
|
|
94
|
-
{% set sectionStyles = styleEntryPoint %}
|
|
95
|
-
|
|
96
|
-
{{previewEntryPoint}}
|
|
97
|
-
<style>
|
|
98
|
-
.{{blockClassName}}.{{block.id}}{
|
|
99
|
-
{{sectionStyles}}
|
|
100
|
-
}
|
|
101
|
-
</style>
|
|
102
|
-
<section {{block.anchor ? "id=" ~ block.anchor : ''}} class="{{blockClassName}} {{block.className}} {{classNameEntryPoint}} {{block.id}} lazy-fade" {{dataAttributeEntryPoint}} data-blockid="{{block.id}}" data-assetkey="{{blockClassName}}">
|
|
103
|
-
${swiper ? swiperTemplates.templatetwig(newBlockName) : ''}${
|
|
104
|
-
image ? imageTemplate : ''
|
|
105
|
-
}
|
|
106
|
-
${content ? contentContainerTemplate : ''}
|
|
107
|
-
${vue ? vueTemplates.templatetwig(newBlockName) : ''}
|
|
108
|
-
{{htmlEntryPoint}}
|
|
78
|
+
|
|
79
|
+
<section {{block.anchor ? "id=" ~ block.anchor : ''}} class="{{blockClassName}} {{block.className}} {{block.id}} lazy-fade" data-blockid="{{block.id}}" data-assetkey="{{blockClassName}}">
|
|
80
|
+
|
|
109
81
|
</section>`;
|
|
110
82
|
|
|
111
83
|
let jsData;
|
|
@@ -140,16 +112,6 @@ fs.writeFileSync(
|
|
|
140
112
|
`${themePath}/inc/acf-blocks/${newBlockName}/block.json`,
|
|
141
113
|
acfTemplate(newBlockName, projectName)
|
|
142
114
|
);
|
|
143
|
-
// fs.writeFileSync(
|
|
144
|
-
// `./cypress/e2e/components/${newBlockName}.cy.js`,
|
|
145
|
-
// cypressJs(newBlockName)
|
|
146
|
-
// );
|
|
147
|
-
if (vue) {
|
|
148
|
-
fs.writeFileSync(
|
|
149
|
-
`${themePath}/assets/vue/blocks/${newBlockName}.vue`,
|
|
150
|
-
vueTemplates.templatevuefile(newBlockName)
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
115
|
|
|
154
116
|
console.log(
|
|
155
117
|
`👑 👑 👑 Hurrah! You made a new block called ${newBlockName} 👑 👑 👑`
|
|
@@ -7,17 +7,22 @@ module.exports = function (newBlockName, projectName) {
|
|
|
7
7
|
return `{
|
|
8
8
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
9
9
|
"apiVersion": 3,
|
|
10
|
-
"name": "
|
|
10
|
+
"name": "acf/${newBlockName}",
|
|
11
11
|
"title": "${blockTitle}",
|
|
12
|
-
"category": "
|
|
13
|
-
"icon": "smiley",
|
|
12
|
+
"category": "project-blocks",
|
|
14
13
|
"description": "${blockTitle} block",
|
|
15
|
-
"keywords": ["content"
|
|
14
|
+
"keywords": ["content"],
|
|
16
15
|
"version": "1.0.0",
|
|
17
16
|
"textdomain": "${namespace}",
|
|
17
|
+
"acf": {
|
|
18
|
+
"mode": "preview",
|
|
19
|
+
"renderCallback": "core_block_render_post_object_v3",
|
|
20
|
+
"blockVersion": 3
|
|
21
|
+
},
|
|
18
22
|
"supports": {
|
|
23
|
+
"align": false,
|
|
19
24
|
"anchor": true,
|
|
20
|
-
"
|
|
25
|
+
"jsx": true
|
|
21
26
|
},
|
|
22
27
|
"example": {
|
|
23
28
|
"attributes": {
|
|
@@ -26,10 +31,6 @@ module.exports = function (newBlockName, projectName) {
|
|
|
26
31
|
"is_example": true
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
|
-
},
|
|
30
|
-
"acf": {
|
|
31
|
-
"mode": "preview",
|
|
32
|
-
"renderCallback": "core_block_render_post_object_v3"
|
|
33
34
|
}
|
|
34
35
|
}`;
|
|
35
36
|
};
|