|
|
před 2 týdny | |
|---|---|---|
| .. | ||
| .vscode | před 2 týdny | |
| data | před 2 týdny | |
| docker | před 2 týdny | |
| favicon | před 2 týdny | |
| scripts | před 2 týdny | |
| styles | před 2 týdny | |
| .gitignore | před 2 týdny | |
| README.md | před 2 týdny | |
| edit.html | před 2 týdny | |
| index.html | před 2 týdny | |
| package.json | před 2 týdny | |
| postcss.config.js | před 2 týdny | |
You can run the generator online:
Alternatively, you can download the generator as a small app written in vanilla Javascript:
…and transfer it to your own server.
If running the generator locally, a local server will need to be started (eg: using the Five Server extension in VS Code) in order for the generator to work (browsers block ES Javascript imports from being used locally).
(for bundling styles and using postcss)
Based on the level of control you need over the styles for the generator and the contract itself, you can go with one of the following 3 options:
The generator can be used without any build step, with the existing contract styles (in regular/vanilla css) already compiled in data/style.min.css.
Build your own docker image or use the latest image from Docker hub
To run the image as a standalone container, use the following commands:
docker pull sarangcr03/nonsalant-contract:latest
docker run -p 9090:80 sarangcr03/nonsalant-contract:latest
For those who prefer Docker Compose, below is a simple docker-compose.yml example that sets up the service:
version: '3.8'
services:
web:
image: sarangcr03/nonsalant-contract:latest
ports:
- "9090:80"
Start the service using:
docker-compose up
With this method you are not mapping an internal port to a host port in docker, so you must add a proxy host pointing to "http://contract-app:80" in the nginx proxy manager admin panel which will be located at http://localhost:81/ (replace localhost with the ip address or hostname of the docker host)
docker-compose.yml example:
version: '3.8'
services:
nginx-proxy-manager:
image: jc21/nginx-proxy-manager:latest
restart: unless-stopped
ports:
- '80:80' # HTTP
- '81:81' # Admin interface
- '443:443' # HTTPS
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
networks:
- contract-net
contract-app:
image: sarangcr03/nonsalant-contract:latest
restart: unless-stopped
networks:
- contract-net
networks:
contract-net:
driver: bridge
Start the service using:
docker-compose up
(in 📁data/more-data/css)
The styles for the contract use postcss for:
To edit the uncompilled postcss, a build step is needed with the following commands to “build” or “watch” (re-build on every change) the contract styles:
npm run postcss:build
npm run postcss:watch
All the CSS for the contract styles (all files in the 📁data/more-data/css folder, coming in through the main.css entrypoint) will be compilled from postcss to regular CSS (in data/style.min.css).
All CSS for the generator styles (all files in the 📁styles folder, coming in through the main.css entrypoint) are currently written in regular CSS and loaded using CSS @imports.
The contract's data/style.min.css is also imported in the generator's main.css entry point using a regular CSS @import.
Postcss configuration can be found in postcss.config.js
(in 📁styles)
If you intend to write postcss in the generator's styles too (in addition to the contract styles mentioned above, where postcss is enabled by default), you will need a separate watch command to process the postcss:
postcss:watch-generator
...and the following files will need to be edited accordingly:
package.json filereplace:
"scripts": {
"postcss:watch": "postcss data/more-data/css/main.css -o data/style.min.css -w",
"postcss:build": "postcss data/more-data/css/main.css -o data/style.min.css"
},
with:
"scripts": {
"postcss:watch": "postcss data/more-data/css/main.css -o data/style.min.css -w",
"postcss:watch-generator": "postcss styles/main.css -o styles/style.min.css -w",
"postcss:build": "postcss data/more-data/css/main.css -o data/style.min.css & postcss styles/main.css -o style.min.css"
},
edit.html file:replace:
<link rel="stylesheet" href="styles/main.css">
<!-- <link rel="stylesheet" href="styles/style.min.css"> -->
with:
<!-- <link rel="stylesheet" href="/styles/main.css"> -->
<link rel="stylesheet" href="/style.min.css">
All the generator styles (all files in the 📁styles folder, coming in through the main.css entrypoint) will now be compiled from postcss to regular CSS (in styles/style.min.css).
The styles for the contract itself (data/style.min.css mentioned above) are imported in the generator styles using a regular CSS @import.
Postcss configuration can be found in postcss.config.js