Skip to content

match text in postprocess for compiled pug #38

@webdiscus

Description

@webdiscus

@webdiscus something is wrong with postprocess for js. I think /main.js/ is not here in postprocess moment

new PugPlugin({
  postprocess: (content) => {
    // ...content
    content = content.replace(
      /src="(\/.*?\.js)"/g, // doesn't find anything
      `src="FROM(my_zip, '$1')"`,
    );
    return content;
  }),
})

src="(\/.*?\.js)" matches src="/js/main.js"

The links of JS and CSS should be replaced in generated HTML.

Sometimes we need to paste HTML in another parser which reads assets (images, css, js) from zip file and sends to client. So "replacer" replaces to path to zip folder

Originally posted by @silveoj in #36 (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

    Issue actions