Nuxt.js: Idea/Suggestion: Nuxt CLI command for generating pages/components

Created on 7 May 2017  路  8Comments  路  Source: nuxt/nuxt.js

This is just an idea to see what the team behind Nuxt think (not sure if this is the best place for it):

It could be really convenient to add an extra command to the nuxt cli tool to generate new pages/components? I find myself doing this a lot and at the moment it's basically copying and pasting the script, template and style tags from another file and emptying it out. It could also take preferences about languages (pug, sass, etc), and even layouts and store modules, etc. E.g.:

nuxt create component my-component-name
nuxt create page my-page-name --sass

Would you be open to reviewing a PR to implement this, or do you think it's not appropriate to go into this project?

This question is available on Nuxt.js community (#c586)
contributions welcome

All 8 comments

It looks like a job for the editor. For example https://atom.io/packages/language-vue
allows inserting this snippet:

<template lang="html">

</template>

<script>
export default {
}
</script>

<style lang="css">
</style>

when the grammar is vue. The snippet selects 'html' and 'css' so you can replace them.
https://github.com/hedefalk/atom-vue/blob/master/snippets/vue.cson

I also think it just need write a snippet .

Fair enough. I thought there could be a chance to implement something more powerful and useful than what snippets usually gives you, but you're probably right.

I'll leave it open for now as a chance for some other people to weigh in.

Since nuxtmodule should not be installed globally, we cannot add this feature.

But if someone wants to add a plugin for Atom/Visual Studio/SublimeText for Nuxt, it would be awesome!

@Atinux noticed you've begun work on this https://github.com/nuxt/nuxt-cli 馃槉 Please let me know if you need any extra hands on that, I'd love to help create a top notch CLI experience for nuxt

Yay, modules are getting broken out :dark_sunglasses:

@samtgarson Thanks for your interest. We love adding nuxt page <cmd> and other creators to Nuxt-CLI too. Also it would be also possible extending global nuxt-cli per project basis by using modules. Some approach like Laravel's Artisan. entry bin (either global or local) detects project root, boots up nuxt kernel and waits for modules ready to possibly provide more commands :)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vadimsg picture vadimsg  路  3Comments

msudgh picture msudgh  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments