Skip to content

Commit

Permalink
Updated zuix-dist.
Browse files Browse the repository at this point in the history
  • Loading branch information
genemars committed May 26, 2022
1 parent f1e5b51 commit ee8ad31
Show file tree
Hide file tree
Showing 418 changed files with 865 additions and 801 deletions.
58 changes: 42 additions & 16 deletions .eleventy-zuix.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,40 @@ function startWatcher(eleventyConfig, browserSync) {
f = path.resolve(path.join(sourceFolder, f));
watchFiles.push(f);
});
const templateExtensions = ['.js', '.mjs', '.html', '.css', '.less', '.scss', '.njk'];
const templateFolders = componentsFolders.map(f => path.resolve(path.join(sourceFolder, f)));
const copyFilesWatcher = chokidar.watch(watchFiles).on('all', (event, file, stats) => {
if (watchEvents[event] && fs.existsSync(file)) {
if (watchEvents[event] && fs.existsSync(file) && file.indexOf('/_inc/') === -1) {
const outputFile = path.resolve(path.join(buildFolder, file.substring(path.resolve(sourceFolder).length)));
const outputFolder = path.dirname(outputFile);
if (!fs.existsSync(outputFolder)) {
fs.mkdirSync(outputFolder, { recursive: true })
}
fs.copyFileSync(file, outputFile);
const postProcess = templateExtensions.filter(cn => file.endsWith(cn));
if (postProcess.length === 1) {
// Post-process file with Nunjucks
const njk = new nunjucks.Environment(new nunjucks.FileSystemLoader([
path.dirname(file),
...templateFolders
], {}));
njk.render(file, zuixConfig, function(err, res) {
if (err != null) {
console.error(
chalk.red.bold(err)
);
} else {
fs.writeFile(outputFile, res, function() {
// TODO: ...
});
}
});
} else {
// Do not post-process, copy as-is
fs.copyFileSync(file, outputFile);
}
} else {
// TODO: maybe remove file from output folder as well?
// TODO: maybe remove file from output folder as well if it was unlinked?
// TODO: >> recompile dependant files if the modified file is inside an `_inc` folder
}
if (browserSync) {
browserSync.reload();
Expand Down Expand Up @@ -214,20 +238,22 @@ function setupSocketApi(browserSync) {
}
// Capture console output to notify errors
capcon.startCapture(process.stderr, {}, function (stderr) {
stderr = stderr
.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '')
.replace(/ *\([^)]*\) */g, '').replace(/ +$/, '');
if (stderr.indexOf('\n[11ty] ') !== -1) {
errorObject.debug = true;
} else if (stderr.startsWith('[11ty]')) {
stderr = stderr.substring(6).replace(/ +$/, '');
}
errorObject.errors.push(stderr);
if (!errorObject.debug) {
errorObject.message += stderr;
if (stderr && stderr.replace) {
stderr = stderr
.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '')
.replace(/ *\([^)]*\) */g, '').replace(/ +$/, '');
if (stderr.indexOf('\n[11ty] ') !== -1) {
errorObject.debug = true;
} else if (stderr.startsWith('[11ty]')) {
stderr = stderr.substring(6).replace(/ +$/, '');
}
errorObject.errors.push(stderr);
if (!errorObject.debug) {
errorObject.message += stderr;
}
clearTimeout(errorNotifierTimeout);
errorNotifierTimeout = setTimeout(errorNotifier, 250);
}
clearTimeout(errorNotifierTimeout);
errorNotifierTimeout = setTimeout(errorNotifier, 250);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/about/index.bundle.ext.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/about/index.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
.theme-dark [z-load="listview/items-list/item"] .summary {
background-color: rgba(20, 20, 20, 0.7);
transition: background-color 0.3s ease-in-out;
}</style><body><noscript>Turn on JavaScript to access this site content.</noscript><!-- The header bars (for each page) --><nav z-field="header-bar" z-component="fragment" header-bar=""><div class="header" layout="row center-justify" header-bar=""><div z-field="header-box" layout="row center-left" header-bar=""><div class="title" layout="row center-left" header-bar="">About</div></div><div style="margin: 12px;" header-bar=""><input class="theme-toggle" type="checkbox" aria-label="Toggle theme" checked header-bar=""></div></div><div z-field="header-tools" header-bar=""></div></nav><style>[z-component][header-bar] {
}</style><!-- zUIx.js inline resources bundle --><script src="index.bundle.js"></script><body><noscript>Turn on JavaScript to access this site content.</noscript><!-- The header bars (for each page) --><nav z-field="header-bar" z-component="fragment" header-bar=""><div class="header" layout="row center-justify" header-bar=""><div z-field="header-box" layout="row center-left" header-bar=""><div class="title" layout="row center-left" header-bar="">About</div></div><div style="margin: 12px;" header-bar=""><input class="theme-toggle" type="checkbox" aria-label="Toggle theme" checked header-bar=""></div></div><div z-field="header-tools" header-bar=""></div></nav><style>[z-component][header-bar] {
position: fixed; top:0; left:0; right:0; height:auto; border-bottom: solid 1px rgba(0,0,0,0.1); box-shadow: 0 0 8px -1px rgba(0,0,0,0.5); z-index: 2!important;}

[z-component][header-bar]
Expand Down Expand Up @@ -598,4 +598,4 @@
}
.theme-dark footer .active {
color: var(--dark-color--accent)!important;
}</style><!-- Built with love using zUIx Web Starter --><script>function syncPageIndicator(t){zuix.context("page-indicator",function(e){const n=e.$.find("div");n.eq(t.out).removeClass("active"),n.eq(t.in).addClass("active"),e.page(t.in)})}function themeSetup(){const t=zuix.$(document.body),i=t.find(".theme-toggle"),a="theme-dark",o="app.theme",e={transition:"color 300ms ease-in, background-color 300ms ease-in"};function n(e){var n=e?i.checked():"true"===localStorage.getItem(o);e||i.checked(n),n?t.addClass(a):t.removeClass(a),localStorage.setItem(o,String(n))}setTimeout(function(){t.css(e),t.find("header").css(e),t.find("nav").css(e),t.find("footer").css(e)},100),i.on("change",n),n()}zuix.lazyLoad(!0,-window.innerWidth/4),options={pageIndicator:{enablePaging:!0,startGap:40,ready:function(e){const n=e.$.find("div");0<n.length()&&n.each(function(n,e,t){t.on("click",function(e){viewPager&&viewPager.page(n)})})}}},themeSetup()</script><!-- zUIx.js inline resources bundle --><script src="index.bundle.js"></script><!-- zUIx.js inline resources bundle --><script src="index.bundle.ext.js"></script>
}</style><!-- Built with love using zUIx Web Starter --><script>function syncPageIndicator(t){zuix.context("page-indicator",function(e){const n=e.$.find("div");n.eq(t.out).removeClass("active"),n.eq(t.in).addClass("active"),e.page(t.in)})}function themeSetup(){const t=zuix.$(document.body),o=t.find(".theme-toggle"),i="theme-dark",a="app.theme",e={transition:"color 300ms ease-in, background-color 300ms ease-in"};function n(e){var n=e?o.checked():"true"===localStorage.getItem(a);e||o.checked(n),n?t.addClass(i):t.removeClass(i),document.documentElement.style.setProperty("color-scheme",n?"dark":"light"),localStorage.setItem(a,String(n))}setTimeout(function(){t.css(e),t.find("header").css(e),t.find("nav").css(e),t.find("footer").css(e)},100),o.on("change",n),n()}zuix.lazyLoad(!0,-window.innerWidth/4),options={pageIndicator:{enablePaging:!0,startGap:40,ready:function(e){const n=e.$.find("div");0<n.length()&&n.each(function(n,e,t){t.on("click",function(e){viewPager&&viewPager.page(n)})})}}},themeSetup()</script><!-- zUIx.js inline resources bundle --><script src="index.bundle.ext.js"></script>
Loading

0 comments on commit ee8ad31

Please sign in to comment.