-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoe according to feedback. Reuse templates/components, generate …
…exportables from template files.
- Loading branch information
1 parent
d26ca47
commit 206322e
Showing
15 changed files
with
258 additions
and
563 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,27 @@ | ||
import * as fs from 'fs' | ||
|
||
// write script that generates const variable string from /src/defaults/autocomplete.liquid | ||
function generateAutocompleteLiquid() { | ||
const autocompleteLiquid = fs.readFileSync('./src/defaults/autocomplete.liquid', 'utf8') | ||
const autocompleteLiquidLines = autocompleteLiquid.split('\n') | ||
const autocompleteLiquidLinesWithConst = `export const defaultLiquidTemplate = \`\n${autocompleteLiquidLines.map(line => ` ${line}`).join('\n')}\n\`\n` | ||
|
||
fs.appendFileSync('./src/_generated.ts', autocompleteLiquidLinesWithConst) | ||
} | ||
|
||
function generateAutocompleteMustache() { | ||
const autocompleteMustache = fs.readFileSync('./src/defaults/autocomplete.mustache', 'utf8') | ||
const autocompleteMustacheLines = autocompleteMustache.split('\n') | ||
const autocompleteMustacheLinesWithConst = `export const defaultMustacheTemplate = \`\n${autocompleteMustacheLines.map(line => ` ${line}`).join('\n')}\n\`\n` | ||
|
||
fs.appendFileSync('./src/_generated.ts', autocompleteMustacheLinesWithConst) | ||
} | ||
|
||
(() => { | ||
if (fs.existsSync('./src/_generated.ts')) { | ||
fs.unlinkSync('./src/_generated.ts') | ||
} | ||
|
||
generateAutocompleteLiquid() | ||
generateAutocompleteMustache() | ||
})() |
This file was deleted.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.