-
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.
refactor: simplified scaffolding and dependencies, theme optimization…
…s, windicss integration and views ejection prototype
- Loading branch information
Showing
43 changed files
with
1,540 additions
and
841 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"extends": "@fiad" | ||
"extends": "@fiad" | ||
} |
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 @@ | ||
const path = require('path') | ||
const glob = require('glob') | ||
const fs = require('fs-extra') | ||
const { getTemplateFilename, getTemplateContent } = require('./utils') | ||
|
||
const cwd = process.cwd() | ||
const srcPath = path.join(cwd, 'src') | ||
const distPath = path.join(cwd, 'dist/views') | ||
const sourceFiles = glob.sync(path.join(srcPath, '**/*.twig'), { | ||
ignore: [ | ||
'.git/**', | ||
'bin/**', | ||
'dist/**', | ||
'node_modules/**', | ||
'public/**', | ||
'src/**' | ||
] | ||
}) | ||
|
||
fs.emptyDirSync(distPath) | ||
|
||
sourceFiles.forEach(filepath => { | ||
const filename = getTemplateFilename(filepath, srcPath, distPath) | ||
const content = getTemplateContent(filepath) | ||
if (!filename || !content) return | ||
fs.outputFileSync(filename, content) | ||
}) |
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,24 @@ | ||
const path = require('path') | ||
const fs = require('fs-extra') | ||
|
||
module.exports.getTemplateFilename = function(file, srcPath, distPath) { | ||
try { | ||
const base = path.dirname(file).replace(srcPath, distPath) | ||
const name = path.basename(file, '.twig') | ||
return `${(name === 'template') ? base : path.join(base, name)}.twig` | ||
} catch { | ||
return null | ||
} | ||
} | ||
|
||
module.exports.getTemplateContent = function(file) { | ||
try { | ||
return ( | ||
fs.readFileSync(file) | ||
.toString() | ||
.replace(/({{\s?(sourcePath|publicPath)\s?}}|\/template)/g, '')) | ||
.replace(/(\s)*<script type="module" src="\/main.js"><\/script>/, '') | ||
} catch { | ||
return null | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"~/*": ["./src/*"] | ||
} | ||
|
Oops, something went wrong.