Skip to content

Allow parameters for aliasing in templates #172

@piknik

Description

@piknik

I've asked how to do what I want in the forum with no response, so I assume this is a missing feature.

What I want, is to be able to define aliases for vue templates like I do with JavaScript code. Take this sample from a webpack config:

    resolve: {
        extensions: ['', '.js', '.vue'],
        root: path.resolve(__dirname),
        alias: {
            'src': resolveJSPath(''),
            'components': resolveJSPath('components'),
            'store': resolveJSPath('store'),
            'models': resolveJSPath('models'),
            'directives': resolveJSPath('directives'),
            'services': resolveJSPath('services')
        }
    },

This allows me to require or import in my JavaScript like so:

var Public = require('components/public')
var Home = require('components/public/home')
var About = require('components/public/about')
//...etc

Notice the lack of relative paths due to aliasing.
Now, here is one of my Vue templates:

<template lang="jade">
        include ../../../../jade/vue/base

    include ../../../../jade/pages/home
//-...etc

Notice the absurd amount of traversing up the directory due to no aliasing for templates. I've been searching for a solution to this with no results, so I assume this is something that needs to be implemented.

I have a main directory structure like this:

resources/assets/jade
resources/assets/js
resources/assets/sass

I can only assume the same issue exists with loading SASS styles within the .vue file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions