Community Patterns

Community Library Entry

0

Regular Expression
Created·2017-06-01 19:39
Flavor·PCRE (Legacy)

/
<\s*script\s+.+?(?=src\s*=\s*['"]).+?(?=.bundle.js).bundle.js\s*["'](?:\s*>|\s*\/\s*>)(?:\s*<\s*\/\s*script\s*>)?
/
ig
Open regex in editor

Description

Use Case Angular CLI adds in js bundles when a build is performed, one of the bundles are tiny and should be unlined.

Using something like gulp-replace that uses regedx to remove, and gulp-inject to rewrite these links ( and inline code ) can be very beneficial for a post build process if you are looking for an extra pagespeed score bump for SEO ranking etc.

Submitted by anonymous