hugo.soucy.cc

The personnal website source code of Hugo Soucy. Creates from an homebrewed static website generator (Ferron).
Log | Files | Refs

commit ae99ce724cddf5bc16f6745ece85c26dc254fb71
parent 74f2f0b75465d53fe43b220f127f5c8ab4a4efc9
Author: Hugo Soucy <hugo.soucy@equisoft.com>
Date:   Sun,  6 Oct 2019 13:17:01 -0400

Delete the gitignore and add two plugins

Diffstat:
Dplugins/.gitignore | 6------
Aplugins/onchange/init.lua | 22++++++++++++++++++++++
Aplugins/sass/init.lua | 17+++++++++++++++++
3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/plugins/.gitignore b/plugins/.gitignore @@ -1,6 +0,0 @@ -# Ignore everything in this directory -* -# Except those files -!.gitignore -!/httpd -!/httpd/**/* diff --git a/plugins/onchange/init.lua b/plugins/onchange/init.lua @@ -0,0 +1,22 @@ +-- onchange.init.lua +local onchange = {} +local onchangemeta = { + __call = function(self, key, vars) + print(key) + end +} + +local watcher = require 'watcher' + +function onchange.init(sitedata) + local sass = require (sitedata.plugins .. '/sass/').init + local page = require 'ferron.page' + + watcher(sitedata.static_src, function() + --print('Some file was modified now!') + sass(sitedata) + page.makepages(sitedata) + end) +end + +return setmetatable(onchange, onchangemeta) diff --git a/plugins/sass/init.lua b/plugins/sass/init.lua @@ -0,0 +1,17 @@ +-- sass.init.lua +local sass = {} +local sassmeta = { + __call = function(self, key, vars) + print(key) + end +} + +function sass.init(sitedata) + local src = sitedata.static_src .. '/css/styles.scss' + local dest = sitedata.static .. '/css/styles.min.css' + + return os.execute('sassc ' .. src .. ' ' .. dest), + print('SCSS Preprocessed then CSS Updated!') +end + +return setmetatable(sass, sassmeta)