Skip to content

Commit

Permalink
Updated zuix-dist.
Browse files Browse the repository at this point in the history
  • Loading branch information
genemars committed Jun 7, 2022
1 parent 2fb5a23 commit 011cede
Show file tree
Hide file tree
Showing 21 changed files with 1,066 additions and 962 deletions.
52 changes: 49 additions & 3 deletions .eleventy-zuix.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const fs = require('fs');
const chokidar = require('chokidar');
const moment = require('moment');
const nunjucks = require('nunjucks');
const pkg = require('./package.json');

const {
compilePage,
Expand Down Expand Up @@ -95,7 +96,7 @@ function startWatcher(eleventyConfig, browserSync) {
f = path.resolve(path.join(sourceFolder, f));
watchFiles.push(f);
});
const templateExtensions = ['.js', '.mjs', '.html', '.css', '.less', '.scss', '.njk'];
const templateExtensions = ['.html', '.js', '.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) && file.indexOf('/_inc/') === -1) {
Expand All @@ -111,7 +112,7 @@ function startWatcher(eleventyConfig, browserSync) {
path.dirname(file),
...templateFolders
], {}));
njk.render(file, zuixConfig, function(err, res) {
njk.render(file, { pkg, app: zuixConfig.app }, function(err, res) {
if (err != null) {
console.error(
chalk.red.bold(err)
Expand Down Expand Up @@ -369,12 +370,57 @@ function initEleventyZuix(eleventyConfig) {
});
componentsFolders.map(f => {
f = path.join(sourceFolder, f);
eleventyConfig.addPassthroughCopy(f);
postProcessRecursiveSync(f, buildFolder)
});
}
eleventyConfig.setDataDeepMerge(true);
}

function postProcessRecursiveSync( source, target ) {
let files = [];
// Check if folder needs to be created or integrated
const targetFolder = path.join( target, path.basename( source ) );
if ( !fs.existsSync( targetFolder ) ) {
fs.mkdirSync( targetFolder );
}
// Copy
if ( fs.lstatSync( source ).isDirectory() ) {
files = fs.readdirSync( source );
files.forEach( function ( file ) {
const curSource = path.join( source, file );
if ( fs.lstatSync( curSource ).isDirectory() ) {
postProcessRecursiveSync( curSource, targetFolder );
} else {
const templateExtensions = ['.html', '.js', '.css', '.less', '.scss', '.njk'];
const templateFolders = componentsFolders.map(f => path.resolve(path.join(sourceFolder, f)));
const postProcess = templateExtensions.filter(cn => curSource.endsWith(cn));
const outputFile = path.resolve(path.join(buildFolder, curSource.substring(sourceFolder.length)));
if (postProcess.length === 1) {
// Post-process file with Nunjucks
const njk = new nunjucks.Environment(new nunjucks.FileSystemLoader([
path.dirname(curSource),
...templateFolders
], {}));
njk.render(path.resolve(curSource), {pkg, app: zuixConfig.app}, function(err, res) {
if (err != null) {
console.error(
chalk.red.bold(err)
);
} else {
// fs.readFileSync(curSource)
fs.writeFile(outputFile, res, function() {
// TODO: ...
});
}
});
} else {
fs.writeFileSync(outputFile, fs.readFileSync(curSource));
}
}
});
}
}

function copyDependencies(dependencyList) {
const nodeFolder = `${process.cwd()}/node_modules`;
Object.keys(dependencyList).forEach((sourcePath) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
height: 256px;
}
[z-include][z-ready=true].visible-on-ready, [z-load][z-ready=true].visible-on-ready {
transition: opacity 50ms ease-in-out;
transition: opacity 150ms ease-in-out;
}
.drawer-header {
color:white;
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/material-design-tags/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
height: 256px;
}
[z-include][z-ready=true].visible-on-ready, [z-load][z-ready=true].visible-on-ready {
transition: opacity 50ms ease-in-out;
transition: opacity 150ms ease-in-out;
}
.drawer-header {
color:white;
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/page-options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
height: 256px;
}
[z-include][z-ready=true].visible-on-ready, [z-load][z-ready=true].visible-on-ready {
transition: opacity 50ms ease-in-out;
transition: opacity 150ms ease-in-out;
}
.drawer-header {
color:white;
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/zkit-components-tags/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
height: 256px;
}
[z-include][z-ready=true].visible-on-ready, [z-load][z-ready=true].visible-on-ready {
transition: opacity 50ms ease-in-out;
transition: opacity 150ms ease-in-out;
}
.drawer-header {
color:white;
Expand Down
12 changes: 6 additions & 6 deletions docs/feed/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<description></description>
<language>en</language>
<copyright></copyright>
<lastBuildDate>Thu, 26 May 2022 22:09:28 +0200</lastBuildDate>
<pubDate>Thu, 26 May 2022 22:09:28 +0200</pubDate>
<lastBuildDate>Tue, 07 Jun 2022 12:22:19 +0200</lastBuildDate>
<pubDate>Tue, 07 Jun 2022 12:22:19 +0200</pubDate>
<image>
<title>Web App Template</title>
<url>https://zuixjs.github.io/web-app//images/icons/icon-152x152.png</url>
Expand All @@ -19,7 +19,7 @@
<link>https://zuixjs.github.io/web-app//search/</link>
<guid isPermaLink="true">https://zuixjs.github.io/web-app//search/</guid>
<description>Search this website</description>
<pubDate>Thu, 26 May 2022 22:09:28 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:22:19 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/web-app//search/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -28,7 +28,7 @@
<link>https://zuixjs.github.io/web-app//content/docs/</link>
<guid isPermaLink="true">https://zuixjs.github.io/web-app//content/docs/</guid>
<description>Documentation section</description>
<pubDate>Thu, 26 May 2022 22:09:28 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:22:19 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/web-app//content/docs/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -50,7 +50,7 @@
<link>https://zuixjs.github.io/web-app//content/docs/material-design-tags/</link>
<guid isPermaLink="true">https://zuixjs.github.io/web-app//content/docs/material-design-tags/</guid>
<description>Rendering Material Design components using &lt;code&gt;zx&lt;/code&gt; short code</description>
<pubDate>Thu, 26 May 2022 22:09:28 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:22:19 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/web-app//content/docs/material-design-tags/" rel="self" />
<dc:creator></dc:creator><!-- TODO: resolve cover image url either local or on a different site -->
<media:content medium="image" width="300" height="125"
Expand All @@ -76,7 +76,7 @@
<link>https://zuixjs.github.io/web-app//home/</link>
<guid isPermaLink="true">https://zuixjs.github.io/web-app//home/</guid>
<description>zuix.js web app home page</description>
<pubDate>Thu, 26 May 2022 22:09:28 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:22:19 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/web-app//home/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand Down
2 changes: 1 addition & 1 deletion docs/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
height: 256px;
}
[z-include][z-ready=true].visible-on-ready, [z-load][z-ready=true].visible-on-ready {
transition: opacity 50ms ease-in-out;
transition: opacity 150ms ease-in-out;
}
.drawer-header {
color:white;
Expand Down
2 changes: 1 addition & 1 deletion docs/js/zuix/zuix-bundler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* zuix.js v1.1.6 22.05.26 17:50:11 */
/* zuix.js v1.1.7 22.06.06 23:17:57 */

var zuix;
/******/ (function() { // webpackBootstrap
Expand Down
2 changes: 1 addition & 1 deletion docs/js/zuix/zuix-bundler.min.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/js/zuix/zuix-bundler.module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* zuix.js v1.1.6 22.05.26 17:50:11 */
/* zuix.js v1.1.7 22.06.06 23:17:57 */

/******/ var __webpack_modules__ = ({

Expand Down
2 changes: 1 addition & 1 deletion docs/js/zuix/zuix-bundler.module.min.js

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

Loading

0 comments on commit 011cede

Please sign in to comment.