Preact-cli: Docs for new users: where is the HTML template?

Created on 3 Mar 2018  路  6Comments  路  Source: preactjs/preact-cli

I'm new to Preact and preact-cli and can't seem to find out how (where) to add a <script> to use a CDN-hosted library. Where's the <body> section of the HTML?

I ran preact create material myapp, but can't see where style/index.css or manifest.js are loaded from. The latter is visible if I View source while running the dev server, but I don't see how the stylesheet is loaded.

After (IMO too) much digging, it seems the underlying issue is #428. Until that's solved, can we document how to change the HTML template? Or is this an issue with @prateekbh's preact-material-boilerplate rather?

has-fix

Most helpful comment

Honestly I can't remember if the next version has it included yet or not, but we can easily do it.

For now you can just do something like this:

# copy the template into "src/template.html"
$ cp node_modules/preact-cli/lib/resources/template.html src/.

Then update both watch and build commands with a --template src/template.html as @prateekbh mentioned above.

All 6 comments

oh yes, you can copy paste this in your project for now: https://github.com/developit/preact-cli/blob/52e9843bdd0218d563df756391c6414fabf8c2c3/src/resources/template.html

then, use --template flag to point to the pasted file

e.g.: https://github.com/prateekbh/preact-material-components/blob/master/docs/package.json#L8

Hope this helps

Any updates on making the HTML template more easily accessible? Seems like a pretty common requirement, e.g. to add meta tags to the HTML; or is there a better practice for that sort of thing?

@developit @lukeed @reznord for more visibility

Honestly I can't remember if the next version has it included yet or not, but we can easily do it.

For now you can just do something like this:

# copy the template into "src/template.html"
$ cp node_modules/preact-cli/lib/resources/template.html src/.

Then update both watch and build commands with a --template src/template.html as @prateekbh mentioned above.

@ForsakenHarmony, you've been closing a bunch of issues. Can you please add a resolution to the issue so that visitors who land here from a web search can quickly figure out what the status is?

705

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zwrawr picture zwrawr  路  3Comments

haggen picture haggen  路  3Comments

thangngoc89 picture thangngoc89  路  3Comments

nephix picture nephix  路  4Comments

smjnab picture smjnab  路  3Comments