question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Editing existing templates" section should be more verbose

See original GitHub issue

At the docs of vue-cli for creating new templates, you say “you can inherit and replace parts of an existing template file (even from another package) using YAML front-matter”. But it’s not clear where to put this content. (for a beginner like me) Should it be a new file in templates, or a long string in index.js, etc.

I Always get the error:

Error: Cannot find module ‘App.vue’ from ‘/home/…/vue-cli-plugin-extensionpoints/generator/template/src’

You can only specify the exact path in the extends YAML field. What If I want to extend a file of the current project (the project the vue plugin is applied to) - you don’t know the name yet.

This should be addressed a bit more clearly, like:

In addition, you can inherit and replace parts of an existing template file (even from another package) using YAML front-matter. Just place a file in the templates folder using the same path as the targeted file, with the following content:

Or something similar. But I didn’t find a solution until now. Couldn’t find on in the internet neither.

If you give me a hint I can create a PR too.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
BashirRezaieecommented, Jan 27, 2020

Hi, I have the same problem, Is there any solution?

1reaction
NataliaTepluhinacommented, Dec 24, 2019

Unfortunately, it doesn’t seem YAML Frontmatter can handle relative paths nicely. I’ve been able modifying App.vue with the absolute path but relative is an issue. Even if we pass the correct resolved path from generator it resolves in the template but not in the YAML header:

// generator.js

const appPath = api.resolve(`./src/App.vue`)

api.render('./template', {
  ...options,
  appPath
});
---
extend: <%= appPath %>  // this does not resolve
replace: !!js/regexp /<script>[^]*?<\/script>/
title: <%= appPath %>
---

<script>
export default {
  <%= appPath %> // this resolves to correct absolute path
}
</script>

Will look into it further 🤷‍♀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edit templates - Microsoft Support
Edit or update your built-in or custom templates.
Read more >
Edit project templates - Workfront - Experience League - Adobe
(Conditional) To edit all information about the template, click the More menu next to the name of the template, then click Edit. The...
Read more >
Edit templates | JetBrains Rider Documentation
You can edit template body, change shortcuts for live templates and descriptions for all templates, change template scope, introduce or modify ...
Read more >
BI Publisher - Template Editing Tools - Oracle Help Center
This section describes additional tools provided with the Template Builder to help you validate and edit the template.
Read more >
Creating and Editing Mail and Web Templates - Lsoft
Section 9 Creating and Editing Mail and Web Templates ... During startup, LISTSERV will migrate existing templates from WWW_ARCHIVE MAILTPL to SITE MAILTPL, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found