-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { copyFileSync, existsSync, mkdirSync, writeFileSync } from 'fs'; | ||
|
||
/** | ||
* Write the template to the build-static directory so that it can be uploaded to GAM | ||
* | ||
* @param template The name of the template | ||
* @param html The HTML to write | ||
* @param css The CSS to write | ||
*/ | ||
const writeTemplate = (template: string, html: string, css: string) => { | ||
const outDir = `build-static/${template}`; | ||
|
||
mkdirSync(outDir, { recursive: true }); | ||
|
||
writeFileSync(`${outDir}/index.html`, html, 'utf-8'); | ||
writeFileSync(`${outDir}/style.css`, css, 'utf-8'); | ||
|
||
const adJSON = `src/templates/csr/${template}/ad.json`; | ||
|
||
if (existsSync(adJSON)) { | ||
copyFileSync(adJSON, `${outDir}/ad.json`); | ||
} | ||
}; | ||
|
||
export { writeTemplate }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters