2

What is the best way to split nuxt.js views, components (and layouts) into separate files (at design time, not after build)? With complex and large views and components I find it extremely annoying when I need to switch between template and script (to look something up, etc.).

Ideally, I would be able to define:

- foo.vue.html
- foo.vue.js
- foo.vue.css

and let the build/generate process do the rest. I am using generation of prerendered SPAs (nuxt generate) so the solution, if there is one, would have to be compatible.

1 Answer 1

9

You need to do it somewhat manually like described in vue docs

<!-- my-component.vue -->
<template>
  <div>This will be pre-compiled</div>
</template>
<script src="./my-component.js"></script>
<style src="./my-component.css"></style>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.