Skip to content

Vite support #319

@Muffinman

Description

@Muffinman

I'm struggling to get this working properly with Vite assets.

This is because Vite does not currently expose a way of getting the filesystem path for a chunked asset.

It's possible to get an HTTP link to the asset below, but this will not work in a CI environment.

Config::set('css-inliner.css-files', [
    // Returns HTTP URL to the asset. Not useful for me because the URL does not resolve in CI environment
    Vite::asset('my-styles.css');
]);

Vite has protected methods for returning the chunked filename, so it's not possible to call Vite::chunk() or Vite::manifest() directly.

I can however, get the content of the files with Vite::content('my-styles.css'), so I would propose to add a new config option css-inliner.css-content which would allow this to be used as below.

Config::set('css-inliner.css-content', [
    Vite::content('my-styles.css');
]);

Maybe I've missed something so let me know if there's another way of doing this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions