Skip to content

Add inline feature to the plugin #157

Closed
@lcxfs1991

Description

@lcxfs1991

Hi Jan, I am considering to help add inline features to the plugin. What do you think?

In our business, we usually sth like <script src="xxx.js?__inline"></script> to make js or other static files inline in html files. This will greatly help us optimize the speed in certain circumstance.

Best regards,

Lee

Activity

lcxfs1991

lcxfs1991 commented on Jan 6, 2016

@lcxfs1991
Author

This feature will encourage more person to use webpack instead of gulp.

For me, I am using gulp for resources inline and image sprites.

lcxfs1991

lcxfs1991 commented on Jan 6, 2016

@lcxfs1991
Author

I study the source code, and find that it maybe difficult to add code to make files inline. But I think it is ok to add attributes or queries for next plugin to complete the resource inline jobs. For example, I can pass options like this:

var htmlPlugin = new HtmlWebpackPlugin({
filename: item + ".html",
excludeChunks: ['test'],
template: "src/" + item + ".html",
chunks: ['preview/preview', 'report/report'],
inject: true,
jsAttr: 'inline',
cssAttr: 'inline'
});

Then the result gives me:

or <script src="xxx.js?__inline"></script> or <script src="xxx.js" inline></script>

I don't think this features will server for resource inline. It can server for other attributes like asyc, defer and so on.

If you think this is good, I can add this feature for the plugin and develop another plugin exclusively for resource inline.

Best regards,

Lee

jantimon

jantimon commented on Jan 7, 2016

@jantimon
Owner

I could add an event so you might inline everything during this event in another plugin - would that be a proper solution?

jantimon

jantimon commented on Jan 7, 2016

@jantimon
Owner

Added events which should allow you inlining the files:
https://github.com/ampedandwired/html-webpack-plugin/tree/feature/loaders#events

ghost

ghost commented on Dec 19, 2016

@ghost

link 404

lock

lock commented on May 31, 2018

@lock

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

locked as resolved and limited conversation to collaborators on May 31, 2018
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

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lcxfs1991@jantimon

        Issue actions

          Add inline feature to the plugin · Issue #157 · jantimon/html-webpack-plugin