Loading custom assets when building Static sites ie SSG? #15989
Unanswered
ishaanparlikar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a project structure which when SSG built, I need to add corresponding dependencies into the final bundle and load them on the page.
I have added a demo. Just run
npm run generate
for SSG build. You can see there is a test.html file is generated with correct HTML.Now, I want to add or link js and css files inside template1 on to final build. But they has to go through optimization pipeline and should be added on the test.html page. If possible, I would like to keep the fileName same in the build folder. Like, landing.js or test.js.
I am planning to add a config file which can generate different routes in the pre-render script.
How it can be achieved? It is for internal tool that we are developing which can build us static sites on the fly faster. And we are trying to use our existing files.
Example Repo : https://stackblitz.com/edit/bluwy-create-vite-extra-9oncnh?file=server.js
Beta Was this translation helpful? Give feedback.
All reactions