mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
f499662afc
- added `/:paletteSlug/:resolution` functionality for localhost testing - created `currFile.sublayers` for *things that should zoom with the canvas layers* - `currFile.layers` now solely contains the canvas layers - added `getProjectData` to `FileManager`'s exported methods --- - added `FileManager.localStorageSave` (it's basically just: localStorage.setItem("lpe-cache",FileManager.getProjectData())) - added `FileManager.localStorageCheck` (it's basically just: `!!localStorage.getItem("lpe-cache")`) - added `FileManager.localStorageLoad` (it's basically just: `return localStorage.getItem("lpe-cache")`) - added `FileManager.localStorageReset` (for debugging purity) --- - calling `FileManager.localStorageSave()` on mouse up (we should stress test this) --- - changed lpe file format to `{canvasWidth:number,canvasHeight:number,selectedLayer:number,colors:[],layers:[]}` - added backward compatibility for the old lpe file format --- - added some canvas utility functions in `canvas_util` - added Unsettled's color similarity utility functions in `color_util2` --- - html boilerplate - wang tiles - - POC - tiny text boilerplate - POC - tiny text font scraper --- - WIP - added two optional url route parameters `/:paletteSlug/:resolution/:prefillWidth/:prefillBinaryStr` - WIP POC - hbs_parser.js (outputs tree data about hbs file relationships)
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const HANDLEBARS = require('handlebars');
|
|
const sass = require('sass');
|
|
|
|
const result = sass.compile('./css/pixel-editor.scss');
|
|
fs.writeFileSync("./css/pixel-editor.css",result.css);
|
|
|
|
// fs.readFile('/css/pixel-editor.scss', function(err, scssFile) {
|
|
// compiler.compile(scssFile.toString(), function(err, css) {
|
|
// });
|
|
// });
|
|
|
|
const hbsArr = [
|
|
...fs.readdirSync("./views/").filter(n=>n.slice(-3)==="hbs").map(n=>"./views/" + n),
|
|
...fs.readdirSync("./views/components/").filter(n=>n.slice(-3)==="hbs").map(n=>"./views/components/" + n),
|
|
...fs.readdirSync("./views/logs/").filter(n=>n.slice(-3)==="hbs").map(n=>"./views/logs/" + n),
|
|
...fs.readdirSync("./views/popups/").filter(n=>n.slice(-3)==="hbs").map(n=>"./views/popups/" + n),
|
|
];
|
|
const HBS_STR_MAP = {};
|
|
const HBS_SPEC_MAP = {};
|
|
const HBS_TEMPLATE_MAP = {};
|
|
const HBS_META_DATA = hbsArr.reduce((r,filePath,i)=>{
|
|
|
|
const fileStr = fs.readFileSync(filePath,"utf8");
|
|
const sp0 = fileStr.split("{{> ").slice(1);
|
|
const partialArr = sp0.map(n=>n.split("}}")[0]);
|
|
const sp1 = fileStr.split("{{").slice(1);
|
|
|
|
if(sp0.length || sp1.length) {
|
|
const dblCurlsArr = sp1.map(n=>n.split("}}")[0]);
|
|
|
|
HBS_STR_MAP[filePath] = fileStr;
|
|
|
|
HBS_SPEC_MAP[filePath] = HANDLEBARS.precompile(fileStr);
|
|
// HBS_TEMPLATE_MAP[filePath] = HANDLEBARS.template(HBS_SPEC_MAP[filePath]);
|
|
|
|
r[filePath] = {
|
|
fileStr,
|
|
filePath,
|
|
dblCurlsArr,
|
|
partialArr
|
|
};
|
|
}
|
|
|
|
return r;
|
|
},{});
|
|
|
|
fs.writeFileSync(
|
|
"./js/HBS_META_DATA.js",
|
|
"const HBS_META_DATA = " + JSON.stringify(HBS_META_DATA,null,4)
|
|
); |