Skip to content

Add attributes to generateJSReferences #5

@pldg

Description

@pldg

I was trying to add some attributes in my script tag and I had to customize generateJSReferences function:

function generateJSReferences(files = [], publicPath = '', attributes = '') {
  return files
    .map(file => `<script src="${publicPath}${file}" ${attributes}></script>`)
    .join('');
}

I can call it in my custom template like so: ${generateJSReferences(js, publicPath, 'defer="defer"')}.

Would be nice to have this functionality by default in mini-html-webpack-plugin. What do you think? You can do the same for generateCSSReferences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions