Skip to content

Can I use absolute paths for my require statements? #29

Description

@seangwright

Hello!

I'm trying to use this loader to import partials into other partials or html files and I would like to use paths from the root of my src/ in my @require() imports.

I have a directory structure like this

src/
+-- footer.html
+-- header.html
+-- features/
|   +-- users/
|    |    +-- users.html
+-- pages/
|   +-- about-us/
|    |    +-- about-us.html

I currently have src/features/users/users.html looking like this

<div class="users">
    <i class="fas fa-plus"></i>
    <h1>Users</h1>
    <span>Users</span>
    <span>Users</span>
    <span>Users</span>
    <span>Users</span>
    <span>Users</span>
</div>

And my src/pages/about-us/about-us.html looks like this

<!-- header -->
@require('../../header.html')

<h1>About Us</h1>

<!-- users -->
@require('../../features/users/users.html') 
@require('../../features/users/users.html') 
@require('../../features/users/users.html')

<!-- footer -->
@require('../../footer.html')

I would like to get rid of the ../../ in the @require() and instead path from the root like @require('features/users/users.html') and @require('header.html')

Is there a way through syntax, conventions or configuration to do this?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions