From 9c096541ce78556b7fcc4ab279344381aed082d6 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 1 Feb 2018 06:52:06 -0500 Subject: [PATCH] feat: allow FRESH themes to specify base folder Currently, FRESH themes contain a `src` folder that contains theme artifacts. This commit allows the theme to specify a different folder (including "." or ""), supporting arbitrary folder structures. --- dist/core/fresh-theme.js | 7 +++++-- src/core/fresh-theme.coffee | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/core/fresh-theme.js b/dist/core/fresh-theme.js index a68d12c..ff12b43 100644 --- a/dist/core/fresh-theme.js +++ b/dist/core/fresh-theme.js @@ -36,7 +36,10 @@ Definition of the FRESHTheme class. */ FRESHTheme = (function() { - function FRESHTheme() {} + function FRESHTheme() { + this.baseFolder = 'src'; + return; + } /* Open and parse the specified theme. */ @@ -98,7 +101,7 @@ Definition of the FRESHTheme class. var copyOnly, fmts, jsFiles, major, that, tplFolder; that = this; major = false; - tplFolder = PATH.join(this.folder, 'src'); + tplFolder = PATH.join(this.folder, this.baseFolder); copyOnly = ['.ttf', '.otf', '.png', '.jpg', '.jpeg', '.pdf']; fmts = READFILES(tplFolder).map(function(absPath) { return _loadOne.call(this, absPath, formatsHash, tplFolder); diff --git a/src/core/fresh-theme.coffee b/src/core/fresh-theme.coffee index 1a97ddc..e0a65fb 100644 --- a/src/core/fresh-theme.coffee +++ b/src/core/fresh-theme.coffee @@ -24,7 +24,9 @@ READFILES = require 'recursive-readdir-sync' @class FRESHTheme ### class FRESHTheme - + constructor: () -> + @baseFolder = 'src' + return ### Open and parse the specified theme. ### open: ( themeFolder ) -> @@ -86,7 +88,7 @@ _load = (formatsHash) -> that = @ major = false - tplFolder = PATH.join @folder, 'src' + tplFolder = PATH.join @folder, @baseFolder copyOnly = ['.ttf','.otf', '.png','.jpg','.jpeg','.pdf']