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 ee8ad31 commit 8f7bfce
Show file tree
Hide file tree
Showing 14 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
26 changes: 13 additions & 13 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:15:47 +0200</lastBuildDate>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<lastBuildDate>Tue, 07 Jun 2022 12:26:47 +0200</lastBuildDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<image>
<title>News Blog</title>
<url>https://zuixjs.github.io/news-blog/images/icons/icon-152x152.png</url>
Expand All @@ -19,7 +19,7 @@
<link>https://zuixjs.github.io/news-blog/js/zuix/animate-css.js</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/js/zuix/animate-css.js</guid>
<description></description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/js/zuix/animate-css.js" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -28,7 +28,7 @@
<link>https://zuixjs.github.io/news-blog/</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/</guid>
<description>A brand new *zuix.js* project!</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -37,7 +37,7 @@
<link>https://zuixjs.github.io/news-blog/about/</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/about/</guid>
<description>A news blog template inspired by G.News</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/about/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -46,7 +46,7 @@
<link>https://zuixjs.github.io/news-blog/ui/_inc/content-frame/</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/ui/_inc/content-frame/</guid>
<description></description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/ui/_inc/content-frame/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -55,7 +55,7 @@
<link>https://zuixjs.github.io/news-blog/search/</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/search/</guid>
<description>A news blog template inspired by G.News</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/search/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -64,7 +64,7 @@
<link>https://zuixjs.github.io/news-blog/saved/</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/saved/</guid>
<description>A news blog template inspired by G.News</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/saved/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand Down Expand Up @@ -1750,7 +1750,7 @@
<link>https://zuixjs.github.io/news-blog/home/</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/home/</guid>
<description>A news blog template inspired by G.News</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/home/" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -1759,7 +1759,7 @@
<link>https://zuixjs.github.io/news-blog/content/travel/index.json</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/content/travel/index.json</guid>
<description>No description provided.</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/content/travel/index.json" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -1768,7 +1768,7 @@
<link>https://zuixjs.github.io/news-blog/content/world/index.json</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/content/world/index.json</guid>
<description>No description provided.</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/content/world/index.json" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -1777,7 +1777,7 @@
<link>https://zuixjs.github.io/news-blog/content/top/index.json</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/content/top/index.json</guid>
<description>No description provided.</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/content/top/index.json" rel="self" />
<dc:creator></dc:creator>
</item>
Expand All @@ -1786,7 +1786,7 @@
<link>https://zuixjs.github.io/news-blog/content/europe/index.json</link>
<guid isPermaLink="true">https://zuixjs.github.io/news-blog/content/europe/index.json</guid>
<description>No description provided.</description>
<pubDate>Thu, 26 May 2022 22:15:47 +0200</pubDate>
<pubDate>Tue, 07 Jun 2022 12:26:47 +0200</pubDate>
<atom:link href="https://zuixjs.github.io/news-blog/content/europe/index.json" rel="self" />
<dc:creator></dc:creator>
</item>
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 8f7bfce

Please sign in to comment.