Skip to content

[FEATURE REQUEST] Preload support #60

Closed

Description

@ladown

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?

Activity

  1. webdiscus commented on Jan 20, 2023

    @webdiscus
    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.

  2. ladown commented on Jan 20, 2023

    @ladown
    Author

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

  3. changed the title [-]Preload support[/-] [+][FEATURE REQUEST] Preload support[/+] on Jan 21, 2023
  4. webdiscus commented on Mar 10, 2023

    @webdiscus
    Owner

    @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.

  5. Repository owner locked and limited conversation to collaborators on Mar 10, 2023
  6. converted this issue into a discussion #67 on Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwontfixThis will not be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions