@@ -90,7 +90,7 @@ export class StackblitzWriter {
9090
9191 // TODO(josephperrott): Prevent including assets to be manually checked.
9292 if ( data . selectorName === 'icon-svg-example' ) {
93- this . _readFile ( form , data , 'assets/img/examples/thumbup-icon.svg' , '' ) ;
93+ this . _readFile ( form , data , 'assets/img/examples/thumbup-icon.svg' , '' , false ) ;
9494 }
9595
9696 Promise . all ( templateContents . concat ( exampleContents ) ) . then ( ( ) => {
@@ -117,22 +117,42 @@ export class StackblitzWriter {
117117 form . appendChild ( input ) ;
118118 }
119119
120- /** Reads the file and adds its text to the form */
121- _readFile ( form : HTMLFormElement , data : ExampleData , filename : string , path : string ) : void {
120+ /**
121+ * Reads the file and adds its text to the form
122+ * @param form the html form you are appending to
123+ * @param data example metadata about the example
124+ * @param filename file name of the example
125+ * @param path path to the src
126+ * @param prependApp whether to prepend the 'app' prefix to the path
127+ */
128+ _readFile ( form : HTMLFormElement ,
129+ data : ExampleData ,
130+ filename : string ,
131+ path : string ,
132+ prependApp = true ) : void {
122133 this . _http . get ( path + filename ) . toPromise ( ) . then (
123- response => this . _addFileToForm ( form , data , response . text ( ) , filename , path ) ,
134+ response => this . _addFileToForm ( form , data , response . text ( ) , filename , path , prependApp ) ,
124135 error => console . log ( error ) ) ;
125136 }
126137
127- /** Adds the file text to the form. */
138+ /**
139+ * Adds the file text to the form.
140+ * @param form the html form you are appending to
141+ * @param data example metadata about the example
142+ * @param content file contents
143+ * @param filename file name of the example
144+ * @param path path to the src
145+ * @param prependApp whether to prepend the 'app' prefix to the path
146+ */
128147 _addFileToForm ( form : HTMLFormElement ,
129148 data : ExampleData ,
130149 content : string ,
131150 filename : string ,
132- path : string ) {
151+ path : string ,
152+ prependApp = true ) {
133153 if ( path == TEMPLATE_PATH ) {
134154 content = this . _replaceExamplePlaceholderNames ( data , filename , content ) ;
135- } else {
155+ } else if ( prependApp ) {
136156 filename = 'app/' + filename ;
137157 }
138158 this . _appendFormInput ( form , `files[${ filename } ]` , this . _appendCopyright ( filename , content ) ) ;
0 commit comments