55import { MultiCopy } from './../multi_copy' ;
66import destCopy from '../broccoli-dest-copy' ;
77var Funnel = require ( 'broccoli-funnel' ) ;
8- var glob = require ( 'glob' ) ;
98import mergeTrees from '../broccoli-merge-trees' ;
109var path = require ( 'path' ) ;
1110var renderLodashTemplate = require ( 'broccoli-lodash' ) ;
@@ -25,15 +24,15 @@ function modulesFunnel(include: string[], exclude?: string[]) {
2524/**
2625 * Replaces $SCRIPT$ in .html files with actual <script> tags.
2726 */
28- function replaceScriptTagInHtml ( content : string , relativePath : string ) : string {
27+ function replaceScriptTagInHtml ( placeholder : string , relativePath : string ) : string {
2928 var scriptTags = '' ;
3029 if ( relativePath . match ( / ^ b e n c h m a r k s / ) ) {
3130 scriptTags += '<script src="url_params_to_form.js" type="text/javascript"></script>\n' ;
3231 }
3332 var scriptName = relativePath . replace ( / .* \/ ( [ ^ / ] + ) \. h t m l $ / , '$1.dart' ) ;
3433 scriptTags += '<script src="' + scriptName + '" type="application/dart"></script>\n' +
3534 '<script src="packages/browser/dart.js" type="text/javascript"></script>' ;
36- return content . replace ( '$SCRIPTS$' , scriptTags ) ;
35+ return scriptTags ;
3736}
3837
3938function stripModulePrefix ( relativePath : string ) : string {
@@ -81,7 +80,11 @@ function fixDartFolderLayout(sourceTree) {
8180
8281function getHtmlSourcesTree ( ) {
8382 // Replace $SCRIPT$ markers in HTML files.
84- var htmlSrcsTree = stew . map ( modulesFunnel ( [ '*/src/**/*.html' ] ) , replaceScriptTagInHtml ) ;
83+ var htmlSrcsTree = modulesFunnel ( [ '*/src/**/*.html' ] ) ;
84+ htmlSrcsTree = replace (
85+ htmlSrcsTree ,
86+ { files : [ '*/**' ] , patterns : [ { match : '$SCRIPTS$' , replacement : replaceScriptTagInHtml } ] } ) ;
87+
8588 // Copy a url_params_to_form.js for each benchmark html file.
8689 var urlParamsToFormTree = new MultiCopy ( '' , {
8790 srcPath : 'tools/build/snippets/url_params_to_form.js' ,
0 commit comments