Skip to content

Commit 977fb03

Browse files
committed
publish 1.2.7
1 parent c444c9e commit 977fb03

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@idrinth/react-file-based-routes",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"repository": "https://github.com/idrinth/react-file-based-routes",
55
"description": "A simple file based routing library, that does not force itself on you.",
66
"license": "MIT",

src/generate-folders.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default (cwd: string, configuration: Configuration) => {
2727
const files = readdirSync(cwd + '/' + configuration.fileFinder.distJSRoot, {encoding: 'utf8', recursive: true});
2828
if (configuration.fileBuilder.preLoadCSS) {
2929
for (const file of files) {
30-
if (file.endsWith('.css',) && ! file.startsWith('index-',)) {
30+
if (file.endsWith('.css',) && ! file.startsWith('index-',) && ! file.startsWith('irfbr-',)) {
3131
cssFiles.push(file,);
3232
}
3333
}
@@ -54,7 +54,7 @@ export default (cwd: string, configuration: Configuration) => {
5454
.digest('hex');
5555
const tag = `<script type="text/javascript">setTimeout(() => {const d=document;const s=d.createElement('script');s.setAttribute('type','application/javascript');s.setAttribute('src', '/${configuration.fileFinder.distJSRoot}/irfbr-${name}.js');d.getElementsByTagName('header')[0].appendChild(s)), ${ configuration.fileBuilder.preloadStartDelay })</script>`;
5656
if (jsFiles.length > 0 && cssFiles.length > 0) {
57-
const script = `() => {
57+
const script = `(() => {
5858
${ func }
5959
for (const css of ${JSON.stringify(cssFiles)}) {
6060
append('text/css', 'style', css);
@@ -71,12 +71,12 @@ export default (cwd: string, configuration: Configuration) => {
7171
return tag;
7272
}
7373
if (cssFiles.length > 0) {
74-
const script = `window.setTimeout(() => {
74+
const script = `(() => {
7575
${ func }
7676
for (const css of ${JSON.stringify(cssFiles)}) {
7777
append('text/css', 'style', css);
7878
}
79-
}, ${ configuration.fileBuilder.preloadStartDelay });`;
79+
})();`;
8080
writeFileSync(
8181
`${cwd}/${configuration.fileFinder.distJSRoot}/irfbr-${name}.js`,
8282
minify(script),
@@ -85,12 +85,12 @@ export default (cwd: string, configuration: Configuration) => {
8585
return tag;
8686
}
8787
if (jsFiles.length > 0) {
88-
const script = `window.setTimeout(() => {
88+
const script = `(() => {
8989
${ func }
9090
for (const js of ${JSON.stringify(jsFiles)}) {
9191
append('application/javascript', 'script', js);
9292
}
93-
}, ${ configuration.fileBuilder.preloadStartDelay });`;
93+
})();`;
9494
writeFileSync(
9595
`${cwd}/${configuration.fileFinder.distJSRoot}/irfbr-${name}.js`,
9696
minify(script),

0 commit comments

Comments
 (0)