rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Create layouts/pages/components based on templates

Open lukadriel7 opened this issue 5 years ago • 3 comments

RFC (Request for Comments) Template

Please select your type of RFC (one or more):

Put an x in the boxes that apply

  • [ ] Change ?
  • [x] Method ?
  • [x] Behavior ?
  • [ ] Research ?
  • [x] Innovation ?

Other

  • Start Date: 2020-12-14
  • Target Major Version: 2.x

Does this introduce a breaking change?

Put an x in the box that applies

  • [ ] Yes
  • [x] No

Proposed RFC

Add the possibility to use templates while creating layouts/pages/components/boot with quasar cli. Currently, creating any file using the quasar cli results in some default code being generated for the file. Some component such as QDialog almost all implement the same code. Adding the ability to specify the template of the component at create time using a command such as quasar new component --template dialog which would result in the component being created with the code recommended here would reduce some repetitive task. A new folder named templates could be added in the src folder allowing users to store custom templates they could use to create pages or components.

Possible Folder Structure

└── src/
│   └── templates/
│       ├── components/
│       │   └── dialog.vue
│       ├── layouts/
│       │   └── youtube.vue
│       │   └── github.vue
│       ├── page/
│       │   └── login.vue
│       │   └── profile.vue
└── quasar.conf.js

lukadriel7 avatar Dec 14 '20 00:12 lukadriel7

Sounds like a lot of work for the Quasar team so that you can avoid hitting CRTL+V, CTRL+C. Or am I missing something?

geoidesic avatar Dec 14 '20 05:12 geoidesic

I agree with @lukadriel7. When adding a new component I've to add plenty of code which is the same across all components. Really nice example is dialog with its configuration and custom template part.

Maybe a new Quasar extension could the job for templates?

m0jimo avatar Dec 14 '20 07:12 m0jimo

@geoidesic not only avoiding copy-paste, it could be the basis to enable users to share their own template and make it accessible to others directly from a quasar project. Kinda how extensions work but with templates. This of course being a long term objective. I understand your point, but then again we have a command to create pages, components and layout when we could just create a new file and paste or write some code there by ourselves.

lukadriel7 avatar Dec 14 '20 14:12 lukadriel7