Removed NPM from build process

The base theme needs to be vanilla so it's easy to get going, so npm
dependecies have been removed so the base script is pure JS.

Also created an example config that will tell the system what theme it
should be rendering for development.

Updated the composer script to start a local php server for development.
This commit is contained in:
are0h 2023-04-06 15:57:19 -07:00
parent 98ccdb978c
commit 0799250b8e
11 changed files with 24 additions and 11900 deletions

1
.gitignore vendored
View file

@ -16,3 +16,4 @@ src/*
src/themes/* src/themes/*
!src/themes/theme-fipamo-default !src/themes/theme-fipamo-default
!src/themes/theme-fipamo-default/fipamo-default/assets !src/themes/theme-fipamo-default/fipamo-default/assets
config.json

View file

@ -6,5 +6,10 @@
}, },
"require": { "require": {
"twig/twig": "^3.0" "twig/twig": "^3.0"
},
"scripts": {
"start": [
"@php -S localhost:1414"
]
} }
} }

5
config.json.default Normal file
View file

@ -0,0 +1,5 @@
{
"name": "fipamo-theme-kit",
"version": "1.0.0",
"current_theme": "fipamo-default"
}

View file

@ -6,8 +6,8 @@ class StartKit
{ {
public function __construct() public function __construct()
{ {
$settings = json_decode(file_get_contents("./package.json"), true); $config = json_decode(file_get_contents("./config.json"), true);
$theme = $settings["config"]["current_theme"]; $theme = $config["current_theme"];
new ThemeEngine( new ThemeEngine(
"src/themes/theme-" . $theme, "src/themes/theme-" . $theme,
"/src/themes/theme-" . $theme . "/" . $theme "/src/themes/theme-" . $theme . "/" . $theme

11858
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,26 +0,0 @@
{
"name": "fipamo-theme-kit",
"version": "1.0.0",
"private": true,
"dependencies": {
"parcel": "^2.2.1",
"sass": "^1.49.0"
},
"scripts": {
"watch": "npx parcel watch $npm_package_config_theme_path/com/ThemeStart.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts ",
"build": "npx parcel build $npm_package_config_theme_path/com/ThemeStart.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts",
"dev": "php -S localhost:$npm_package_config_port"
},
"license": "UNLICENSED",
"config": {
"port": "1414",
"current_theme": "fipamo-default",
"theme_path": "src/themes/theme-fipamo-default",
"theme_dir": "src/themes/theme-fipamo-default/fipamo-default"
},
"devDependencies": {
"@parcel/transformer-sass": "^2.2.1",
"stylelint": "^14.14.0",
"stylelint-config-standard": "^29.0.0"
}
}

View file

@ -1,9 +0,0 @@
import Base from "./Base.js";
document.addEventListener(
"DOMContentLoaded",
function () {
var base = new Base();
},
false
);

View file

@ -1,2 +1,9 @@
(()=>{class e{constructor(){this.currentSlide=0,this.slides=document.querySelectorAll('[role="slide"]'),this.start()}start(){this.slides.length>1&&(this.slideInterval=setInterval((()=>{this.slides[this.currentSlide].className="hide",this.currentSlide=(this.currentSlide+1)%this.slides.length,this.slides[this.currentSlide].className="show"}),3e3))}}document.addEventListener("DOMContentLoaded",(function(){new e}),!1)})(); import Base from "./Base.js";
//# sourceMappingURL=ThemeStart.js.map
document.addEventListener(
"DOMContentLoaded",
function () {
var base = new Base();
},
false
);

View file

@ -1 +0,0 @@
{"mappings":"4BAKIA,KAAKC,aAAe,EACpBD,KAAKE,OAASC,SAASC,iBAAiB,kBAExCJ,KAAKK,QAEPA,QACML,KAAKE,OAAOI,OAAS,IACvBN,KAAKO,cAAgBC,aAAW,KAC9BR,KAAKE,OAAOF,KAAKC,cAAcQ,UAAY,OAC3CT,KAAKC,cAAgBD,KAAKC,aAAe,GAAKD,KAAKE,OAAOI,OAC1DN,KAAKE,OAAOF,KAAKC,cAAcQ,UAAY,SAC1C,OCdTN,SAASO,iBACP,oBACA,WACa,IAAIC,KAEjB","sources":["src/themes/theme-fipamo-default/com/Base.js","src/themes/theme-fipamo-default/com/ThemeStart.js"],"sourcesContent":["export default class Base {\n //--------------------------\n // constructor\n //--------------------------\n constructor() {\n this.currentSlide = 0;\n this.slides = document.querySelectorAll('[role=\"slide\"]');\n //alert(\"FRESH\");\n this.start();\n }\n start() {\n if (this.slides.length > 1) {\n this.slideInterval = setInterval(() => {\n this.slides[this.currentSlide].className = \"hide\";\n this.currentSlide = (this.currentSlide + 1) % this.slides.length;\n this.slides[this.currentSlide].className = \"show\";\n }, 3000);\n }\n }\n //--------------------------\n // methods\n //--------------------------\n\n //--------------------------\n // event handlers\n //--------------------------\n}\n","import Base from \"./Base.js\";\n\ndocument.addEventListener(\n \"DOMContentLoaded\",\n function () {\n var base = new Base();\n },\n false\n);\n"],"names":["this","currentSlide","slides","document","querySelectorAll","start","length","slideInterval","setInterval","className","addEventListener","$b8d4b81eabebe07b$export$2e2bcd8739ae039"],"version":3,"file":"ThemeStart.js.map"}

View file

@ -104,6 +104,6 @@
© 2022 Fipamo © 2022 Fipamo
</div> </div>
</footer> </footer>
<script src="{{ assetPath~"scripts/ThemeStart.js?=adfe" }}" type="text/javascript"></script> <script src="{{ assetPath~"scripts/ThemeStart.js" }}" type="module"></script>
</body> </body>
</html> </html>