dokio-create-template 1.0.1 → 1.0.3

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.
@@ -0,0 +1,516 @@
1
+ # Installation & Usage Guide - Step by Step
2
+
3
+ This guide walks you through **everything** you need to know to install and use `dokio-create-template`.
4
+
5
+ ---
6
+
7
+ ## 📦 Installation
8
+
9
+ ### Option 1: Global Installation (Recommended)
10
+
11
+ Install the package globally so you can use it from anywhere:
12
+
13
+ ```bash
14
+ npm install -g dokio-create-template
15
+ ```
16
+
17
+ After installation, verify it works:
18
+
19
+ ```bash
20
+ dokio-create-template --version
21
+ ```
22
+
23
+ ### Option 2: Use with npx (No Installation)
24
+
25
+ If you don't want to install globally, use `npx`:
26
+
27
+ ```bash
28
+ npx dokio-create-template
29
+ ```
30
+
31
+ This will download and run the latest version each time.
32
+
33
+ ### Option 3: Local Installation (For Development)
34
+
35
+ If you want to modify the package:
36
+
37
+ ```bash
38
+ # Clone or download the package
39
+ cd dokio-create-template
40
+
41
+ # Install dependencies
42
+ npm install
43
+
44
+ # Link it globally for testing
45
+ npm link
46
+
47
+ # Now you can run it
48
+ dokio-create-template
49
+ ```
50
+
51
+ ---
52
+
53
+ ## 🚀 Usage
54
+
55
+ ### Basic Usage
56
+
57
+ Simply run the command and follow the prompts:
58
+
59
+ ```bash
60
+ dokio-create-template
61
+ ```
62
+
63
+ ### What You'll Be Asked
64
+
65
+ The CLI will ask you a series of questions:
66
+
67
+ #### 1. Template Type
68
+ ```
69
+ ? What type of template do you want to create?
70
+ ❯ General (Image)
71
+ PDF
72
+ Email
73
+ Video
74
+ ```
75
+
76
+ **Choose based on your needs:**
77
+ - **General**: For images (social media graphics, banners)
78
+ - **PDF**: For print materials (brochures, flyers, certificates)
79
+ - **Email**: For email campaigns (newsletters, marketing emails)
80
+ - **Video**: For video content (social media videos, ads)
81
+
82
+ #### 2. Template Name
83
+ ```
84
+ ? Template name: My Awesome Template
85
+ ```
86
+
87
+ This is the human-readable name that will appear in Dokio.
88
+
89
+ #### 3. Template ID
90
+ ```
91
+ ? Template ID (slug): my-awesome-template
92
+ ```
93
+
94
+ This is the unique identifier. It auto-generates from your template name, but you can customize it.
95
+
96
+ **Rules:**
97
+ - Only lowercase letters
98
+ - Numbers allowed
99
+ - Hyphens allowed
100
+ - No spaces or special characters
101
+
102
+ #### 4. Subdomain
103
+ ```
104
+ ? Subdomain: test
105
+ ```
106
+
107
+ The Dokio subdomain where this template will be used. Common values:
108
+ - `test` - For testing
109
+ - `staging` - For staging environment
110
+ - `production` - For production
111
+
112
+ #### 5. Output Directory
113
+ ```
114
+ ? Output directory: ./my-awesome-template
115
+ ```
116
+
117
+ Where the files will be created. Defaults to `./{template-id}`
118
+
119
+ ### PDF-Specific Questions
120
+
121
+ If you selected **PDF**, you'll also be asked:
122
+
123
+ #### 6. Prince Version
124
+ ```
125
+ ? Prince version:
126
+ ❯ 15
127
+ 11
128
+ ```
129
+
130
+ - **Version 15**: Supports Flexbox (recommended)
131
+ - **Version 11**: Older version, limited features
132
+
133
+ #### 7. Resizable Template
134
+ ```
135
+ ? Is this a resizable template? (y/N)
136
+ ```
137
+
138
+ Say **Yes** if users should be able to change the page size (A4, A3, A5, etc.)
139
+
140
+ #### 8. Dynamic Page Count
141
+ ```
142
+ ? Will this template have dynamic page count? (y/N)
143
+ ```
144
+
145
+ Say **Yes** if users should be able to add/remove pages
146
+
147
+ ---
148
+
149
+ ## 📁 What Gets Generated
150
+
151
+ After running the command, you'll get 4 files:
152
+
153
+ ### 1. `index.html`
154
+ The main template markup with Handlebars syntax.
155
+
156
+ **Example:**
157
+ ```html
158
+ <div class="container">
159
+ <h1>{{{heading}}}</h1>
160
+ <p>{{{body-text}}}</p>
161
+ </div>
162
+ ```
163
+
164
+ ### 2. `style.scss.hbs`
165
+ The stylesheet with SCSS support and Handlebars.
166
+
167
+ **Example:**
168
+ ```scss
169
+ .container {
170
+ padding: 20px;
171
+ background-color: #{{background-color}};
172
+ }
173
+ ```
174
+
175
+ ### 3. `data.yaml`
176
+ Template configuration and field definitions.
177
+
178
+ **Example:**
179
+ ```yaml
180
+ fields_data:
181
+ heading:
182
+ type: text
183
+ title: Heading
184
+ default: Welcome
185
+ ```
186
+
187
+ ### 4. `CHANGELOG.md`
188
+ Version history for your template.
189
+
190
+ ---
191
+
192
+ ## ✏️ Customizing Your Template
193
+
194
+ ### Step 1: Open the Files
195
+
196
+ Navigate to your template directory:
197
+
198
+ ```bash
199
+ cd my-awesome-template
200
+ ```
201
+
202
+ Open the files in your favorite code editor:
203
+
204
+ ```bash
205
+ code . # VS Code
206
+ atom . # Atom
207
+ subl . # Sublime
208
+ ```
209
+
210
+ ### Step 2: Add Fields in data.yaml
211
+
212
+ Want to add a new field? Edit `data.yaml`:
213
+
214
+ ```yaml
215
+ fields_data:
216
+ # Add a text field
217
+ subtitle:
218
+ type: text
219
+ title: Subtitle
220
+ default: Your subtitle here
221
+ placeholder: Enter subtitle
222
+
223
+ # Add a color field
224
+ accent-color:
225
+ type: colour
226
+ title: Accent Color
227
+ customisable: true
228
+ options:
229
+ 'FF0000': Red
230
+ '0000FF': Blue
231
+
232
+ # Add an image field
233
+ logo:
234
+ type: image
235
+ title: Company Logo
236
+ placeholder: logo.png
237
+ options:
238
+ min_width: 400
239
+ min_height: 400
240
+ ```
241
+
242
+ ### Step 3: Use Fields in index.html
243
+
244
+ Reference your fields using triple curly braces:
245
+
246
+ ```html
247
+ <div class="page">
248
+ <!-- Text field -->
249
+ <h2>{{{subtitle}}}</h2>
250
+
251
+ <!-- Image field -->
252
+ <img src="{{{logo}}}" alt="Logo" />
253
+
254
+ <!-- Color field (in inline styles) -->
255
+ <div style="background-color: #{{accent-color}};">
256
+ Content here
257
+ </div>
258
+ </div>
259
+ ```
260
+
261
+ ### Step 4: Style in style.scss.hbs
262
+
263
+ Add your styles (with optional Handlebars):
264
+
265
+ ```scss
266
+ .page {
267
+ padding: 20mm;
268
+
269
+ h2 {
270
+ color: #{{accent-color}};
271
+ font-size: 24pt;
272
+ }
273
+
274
+ img {
275
+ max-width: 100%;
276
+ height: auto;
277
+ }
278
+ }
279
+ ```
280
+
281
+ ---
282
+
283
+ ## 🎯 Complete Examples
284
+
285
+ ### Example 1: Creating a Business Card (PDF)
286
+
287
+ ```bash
288
+ $ dokio-create-template
289
+
290
+ ? Template type: PDF
291
+ ? Template name: Business Card
292
+ ? Template ID: business-card
293
+ ? Subdomain: production
294
+ ? Output directory: ./business-card
295
+ ? Prince version: 15
296
+ ? Resizable: No
297
+ ? Dynamic pages: No
298
+ ```
299
+
300
+ **Customize data.yaml:**
301
+ ```yaml
302
+ dimension_width: 90
303
+ dimension_height: 55
304
+ fields_data:
305
+ name:
306
+ type: text
307
+ title: Name
308
+ default: John Doe
309
+
310
+ title:
311
+ type: text
312
+ title: Job Title
313
+ default: CEO
314
+
315
+ phone:
316
+ type: text
317
+ title: Phone
318
+ placeholder: "+1 234 567 8900"
319
+
320
+ email:
321
+ type: email
322
+ title: Email
323
+ placeholder: john@example.com
324
+ ```
325
+
326
+ ### Example 2: Creating a Newsletter (Email)
327
+
328
+ ```bash
329
+ $ dokio-create-template
330
+
331
+ ? Template type: Email
332
+ ? Template name: Monthly Newsletter
333
+ ? Template ID: monthly-newsletter
334
+ ? Subdomain: marketing
335
+ ? Output directory: ./newsletter
336
+ ```
337
+
338
+ **Customize data.yaml:**
339
+ ```yaml
340
+ fields_data:
341
+ subject:
342
+ type: text
343
+ title: Email Subject
344
+ maximum_characters: 100
345
+
346
+ hero-headline:
347
+ type: text
348
+ title: Hero Headline
349
+ default: This Month's Top Stories
350
+
351
+ articles:
352
+ type: modules
353
+ title: Articles
354
+ modules:
355
+ article:
356
+ title: Article
357
+ fields:
358
+ article-title:
359
+ type: text
360
+ title: Title
361
+ article-content:
362
+ type: textarea
363
+ title: Content
364
+ article-link:
365
+ type: url
366
+ title: Read More Link
367
+ ```
368
+
369
+ ### Example 3: Creating a Social Media Post (General)
370
+
371
+ ```bash
372
+ $ dokio-create-template
373
+
374
+ ? Template type: General (Image)
375
+ ? Template name: Instagram Post
376
+ ? Template ID: instagram-post
377
+ ? Subdomain: social
378
+ ? Output directory: ./instagram-post
379
+ ```
380
+
381
+ **Customize data.yaml:**
382
+ ```yaml
383
+ dimension_width: 1080
384
+ dimension_height: 1080
385
+ fields_data:
386
+ main-text:
387
+ type: text
388
+ title: Main Text
389
+ maximum_characters: 50
390
+
391
+ background-image:
392
+ type: image
393
+ title: Background Image
394
+ options:
395
+ min_width: 1080
396
+ min_height: 1080
397
+ crop:
398
+ allowed_aspect_ratio_options:
399
+ - square
400
+
401
+ overlay-color:
402
+ type: colour
403
+ title: Overlay Color
404
+ customisable: true
405
+ options:
406
+ '000000': Black
407
+ 'FFFFFF': White
408
+ ```
409
+
410
+ ---
411
+
412
+ ## 📤 Uploading to Dokio
413
+
414
+ Once you've customized your template:
415
+
416
+ 1. **Log into Dokio**
417
+ - Go to your Dokio dashboard
418
+ - Navigate to **Templates**
419
+
420
+ 2. **Create New Template**
421
+ - Click **New Template** or **Upload**
422
+
423
+ 3. **Upload Files**
424
+ - Upload `data.yaml` first
425
+ - Upload `index.html`
426
+ - Upload `style.scss.hbs`
427
+
428
+ 4. **Test in Studio**
429
+ - Open the template in Dokio Studio
430
+ - Fill in the fields
431
+ - Generate a preview
432
+ - Download/export when ready
433
+
434
+ ---
435
+
436
+ ## 🔧 Troubleshooting
437
+
438
+ ### "Command not found"
439
+
440
+ **Problem**: After installing, you get `command not found: dokio-create-template`
441
+
442
+ **Solution**:
443
+ ```bash
444
+ # Check npm global path
445
+ npm config get prefix
446
+
447
+ # Add to PATH (in ~/.bashrc or ~/.zshrc)
448
+ export PATH="$PATH:$(npm config get prefix)/bin"
449
+
450
+ # Reload shell
451
+ source ~/.bashrc
452
+ ```
453
+
454
+ ### "Permission denied"
455
+
456
+ **Problem**: Permission error during global install
457
+
458
+ **Solution**:
459
+ ```bash
460
+ # Use sudo (macOS/Linux)
461
+ sudo npm install -g dokio-create-template
462
+
463
+ # Or fix npm permissions (recommended)
464
+ # See: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
465
+ ```
466
+
467
+ ### Files not generating
468
+
469
+ **Problem**: Command runs but no files appear
470
+
471
+ **Solution**:
472
+ ```bash
473
+ # Check current directory
474
+ pwd
475
+
476
+ # Verify output directory exists
477
+ ls -la ./your-template-name
478
+
479
+ # Try specifying full path
480
+ dokio-create-template
481
+ # When asked for output directory: /full/path/to/output
482
+ ```
483
+
484
+ ---
485
+
486
+ ## 🎓 Learning Resources
487
+
488
+ - **Quick Start**: See `QUICKSTART.md`
489
+ - **Setup Guide**: See `SETUP.md`
490
+ - **Dokio Docs**: https://docs.dokio.com
491
+ - **Developer Reference**: Your uploaded PDF
492
+
493
+ ---
494
+
495
+ ## 💡 Tips & Best Practices
496
+
497
+ 1. **Start Simple**: Begin with the generated template, then add features
498
+ 2. **Test Often**: Upload to Dokio and test after each change
499
+ 3. **Version Control**: Use git to track your changes
500
+ 4. **Document Changes**: Update CHANGELOG.md when you make changes
501
+ 5. **Reuse Templates**: Create a base template, then duplicate and customize
502
+
503
+ ---
504
+
505
+ ## 🆘 Getting Help
506
+
507
+ If you're stuck:
508
+
509
+ 1. Check this guide
510
+ 2. Read the Dokio Developer Reference PDF
511
+ 3. Visit Dokio documentation: https://docs.dokio.com
512
+ 4. Contact Dokio support: https://support.dokio.com
513
+
514
+ ---
515
+
516
+ **You're all set!** 🎉 Start creating amazing Dokio templates!
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Dokio @jeikudev
3
+ Copyright (c) 2026 Dokio
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/QUICKSTART.md ADDED
@@ -0,0 +1,218 @@
1
+ # Quick Start Guide
2
+
3
+ Get up and running with `dokio-create-template` in 5 minutes!
4
+
5
+ ## Step 1: Install the Package
6
+
7
+ ```bash
8
+ npm install -g dokio-create-template
9
+ ```
10
+
11
+ ## Step 2: Run the CLI
12
+
13
+ ```bash
14
+ dokio-create-template
15
+ ```
16
+
17
+ ## Step 3: Answer the Prompts
18
+
19
+ ### Example: Creating a PDF Brochure
20
+
21
+ ```
22
+ 🚀 Dokio Template Generator
23
+
24
+ ? What type of template do you want to create?
25
+ ❯ PDF
26
+
27
+ ? Template name:
28
+ Marketing Brochure
29
+
30
+ ? Template ID (slug):
31
+ marketing-brochure
32
+
33
+ ? Subdomain:
34
+ test
35
+
36
+ ? Output directory:
37
+ ./marketing-brochure
38
+
39
+ ? Prince version:
40
+ ❯ 15
41
+
42
+ ? Is this a resizable template?
43
+ No
44
+
45
+ ? Will this template have dynamic page count?
46
+ Yes
47
+ ```
48
+
49
+ ## Step 4: Navigate to Your Template
50
+
51
+ ```bash
52
+ cd marketing-brochure
53
+ ls
54
+ ```
55
+
56
+ You should see:
57
+ - `index.html`
58
+ - `style.scss.hbs`
59
+ - `data.yaml`
60
+ - `CHANGELOG.md`
61
+
62
+ ## Step 5: Customize Your Template
63
+
64
+ ### Edit data.yaml
65
+
66
+ Add more fields or modify existing ones:
67
+
68
+ ```yaml
69
+ fields_data:
70
+ company-name:
71
+ type: text
72
+ title: Company Name
73
+ default: My Company
74
+
75
+ logo:
76
+ type: image
77
+ title: Company Logo
78
+ placeholder: logo.png
79
+ ```
80
+
81
+ ### Edit index.html
82
+
83
+ Add your HTML structure:
84
+
85
+ ```html
86
+ <div class="page">
87
+ <img src="{{{logo}}}" alt="Logo" class="logo" />
88
+ <h1>{{{company-name}}}</h1>
89
+ <div class="body-text">{{{body-text}}}</div>
90
+ </div>
91
+ ```
92
+
93
+ ### Edit style.scss.hbs
94
+
95
+ Add your styles:
96
+
97
+ ```scss
98
+ .logo {
99
+ width: 50mm;
100
+ height: auto;
101
+ margin-bottom: 10mm;
102
+ }
103
+ ```
104
+
105
+ ## Step 6: Upload to Dokio
106
+
107
+ 1. Log into your Dokio account
108
+ 2. Navigate to Templates
109
+ 3. Click "New Template"
110
+ 4. Upload your files:
111
+ - `index.html`
112
+ - `style.scss.hbs`
113
+ - `data.yaml`
114
+ 5. Test your template in the studio!
115
+
116
+ ## Common Customizations
117
+
118
+ ### Adding a New Text Field
119
+
120
+ In `data.yaml`:
121
+ ```yaml
122
+ fields_data:
123
+ subtitle:
124
+ type: text
125
+ title: Subtitle
126
+ default: Your subtitle here
127
+ ```
128
+
129
+ In `index.html`:
130
+ ```html
131
+ <h2>{{{subtitle}}}</h2>
132
+ ```
133
+
134
+ ### Adding a Color Field
135
+
136
+ In `data.yaml`:
137
+ ```yaml
138
+ fields_data:
139
+ accent-color:
140
+ type: colour
141
+ title: Accent Color
142
+ customisable: true
143
+ options:
144
+ 'FF0000': Red
145
+ '00FF00': Green
146
+ '0000FF': Blue
147
+ ```
148
+
149
+ In `index.html` or `style.scss.hbs`:
150
+ ```css
151
+ .highlight {
152
+ color: #{{accent-color}};
153
+ }
154
+ ```
155
+
156
+ ### Adding an Image Field
157
+
158
+ In `data.yaml`:
159
+ ```yaml
160
+ fields_data:
161
+ hero-image:
162
+ type: image
163
+ title: Hero Image
164
+ placeholder: hero.jpg
165
+ options:
166
+ min_width: 1200
167
+ min_height: 600
168
+ ```
169
+
170
+ In `index.html`:
171
+ ```html
172
+ <img src="{{{hero-image}}}" alt="Hero" class="hero" />
173
+ ```
174
+
175
+ ## Template Types Quick Reference
176
+
177
+ ### General (Image)
178
+ - Best for: Social graphics, banners, thumbnails
179
+ - Dimensions: Pixels
180
+ - Exports: JPG, PNG
181
+
182
+ ### PDF
183
+ - Best for: Print materials, documents, certificates
184
+ - Dimensions: Millimeters
185
+ - Exports: PDF (hi-res, low-res, print-ready)
186
+
187
+ ### Email
188
+ - Best for: Marketing emails, newsletters
189
+ - Responsive: Yes
190
+ - Exports: HTML, ZIP, URL
191
+
192
+ ### Video
193
+ - Best for: Social media videos, ads
194
+ - Dimensions: 1920x1080
195
+ - Exports: 1080p video
196
+
197
+ ## Tips
198
+
199
+ 1. **Test locally**: Use the Dokio studio to preview your changes
200
+ 2. **Version control**: Keep track of changes in `CHANGELOG.md`
201
+ 3. **Modular design**: Use modules for repeatable sections
202
+ 4. **Validate**: Test with different content lengths
203
+ 5. **Accessibility**: Add alt text to images, use semantic HTML
204
+
205
+ ## Next Steps
206
+
207
+ - Read the [Dokio Developer Reference](/uploads/Dokio_Developer_Reference.pdf)
208
+ - Explore advanced features (modules, conditionals, copydecks)
209
+ - Check out example templates on Dokio
210
+ - Join the Dokio community
211
+
212
+ ## Need Help?
213
+
214
+ - Documentation: https://docs.dokio.com
215
+ - Support: https://support.dokio.com
216
+ - Developer Reference: See your Dokio Developer Reference PDF
217
+
218
+ Happy templating! 🚀