Skip to content

FTP deployment and .scss #8570

Aug 11, 2023 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

I solved the issue. In my layout.antlers.html I added:

<link rel="stylesheet" href="{{ vite:asset src="resources/css/site.scss" }}"> <script src="{{ vite:asset src="resources/js/site.js" }}"></script>

and I created the tag like this:
`<?php

namespace App\Tags;
use \Statamic\Tags\Tags;
class ViteAssets extends Tags
{
protected static $handle = 'vite';

public function asset()
{
    $asset = $this->params->get('src');

    $manifestPath = public_path('build/manifest.json');
    $manifest = json_decode(file_get_contents($manifestPath), true);

    if (isset($manifest[$asset]['file'])) {
        return '/build/' . $manifest[$asset]['file'];
    }

    return null;
}

}
`

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Verickt
Comment options

Comment options

You must be logged in to vote
1 reply
@Verickt
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jasonvarga
Comment options

Answer selected by Verickt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants