Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Preload support #60

Closed
ladown opened this issue Jan 20, 2023 · 3 comments
Closed

[FEATURE REQUEST] Preload support #60

ladown opened this issue Jan 20, 2023 · 3 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@ladown
Copy link

ladown commented Jan 20, 2023

Hello!

If there are any possibilities how to configure preload for styles or scripts. I found out a plugin, but it requires HtmlWebpackPlugin to be initialized. How can i do it?

@webdiscus
Copy link
Owner

The pug-plugin is designed to replace the html-webpack-plugin, pug-loader and mini-css-extract-plugin completely.
The pug-plugin will never works together with HtmlWebpackPlugin. But very useful features of HtmlWebpackPlugin can be implemented in pug-plugin.

What do the preload-webpack-plugin?
Your imported JS file will be injected into HTML as the link tag like:

<link rel="preload" as="script" href="chunk.31132ae6680e598f8879.js">

You can self this write in Pug:

link(rel="preload" as="script" href=require('./path/to/source/script.js') )

The generated HTML:

<link rel="preload" as="script" href="script.31132ae6680e598f8879.js">

P.S.: Can you please describe your feature request in details what do you concretely want.

@webdiscus webdiscus added the enhancement New feature or request label Jan 20, 2023
@ladown
Copy link
Author

ladown commented Jan 20, 2023

No doubt, that i can set preloaded resources by myself, but i want them to be set automatically, as mentioned plugin do.

@webdiscus webdiscus changed the title Preload support [FEATURE REQUEST] Preload support Jan 21, 2023
@webdiscus
Copy link
Owner

webdiscus commented Mar 10, 2023

@ladown

If there are any possibilities how to configure preload for styles or scripts

This doesn't make sense because all scripts and styles must be manually specified in the Pug template anyway. Therefore, the additional preload attribute can be added directly by yourself.

Тhe only thing that makes sense is the automatic addition of preloads for images, videos, fonts, etc, which was found in the template or in CSS (fonts, images). I put this idea on the stack.

@webdiscus webdiscus added the wontfix This will not be worked on label Mar 10, 2023
Repository owner locked and limited conversation to collaborators Mar 10, 2023
@webdiscus webdiscus converted this issue into discussion #67 Mar 10, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants