Skip to content

Commit

Permalink
Merge pull request #41 from blaylockbk/11ty-test
Browse files Browse the repository at this point in the history
Use 11ty for web app
  • Loading branch information
blaylockbk authored Jul 5, 2023
2 parents 4674e2e + 7dccc2b commit e87d729
Show file tree
Hide file tree
Showing 50 changed files with 70,978 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ _version.py
.gitpod.yml

.DS_Store
node_modules
dev
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"ms-python.python",
"bungcip.better-toml"
"bungcip.better-toml",
"ginfuru.better-nunjucks"
]
}
34 changes: 22 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
// MesoWest Red: #990000
// New Synoptic Blue: #1D4795
// New Synoptic Blue 2 : #74C1E3
"activityBar.background": "#990000",
"activityBarBadge.background": "#FADE2A",
"activityBarBadge.foreground":"#2180AF",
// "activityBar.background": "#990000",
// "activityBarBadge.background": "#FADE2A",
// "activityBarBadge.foreground":"#2180AF",
"titleBar.activeBackground": "#1D4795",
"titleBar.activeForeground": "#ffffff",
"statusBar.background": "#43A047",
"statusBarItem.remoteBackground": "#465A9B",
"button.background": "#2180AF",

// "titleBar.activeForeground": "#ffffff",
// "statusBar.background": "#43A047",
// "statusBarItem.remoteBackground": "#465A9B",
// "button.background": "#2180AF",
},
"python.formatting.provider": "black",

"actionButtons": {
"reloadButton": null,
"loadNpmCommands": false,
Expand All @@ -29,9 +27,21 @@
"singleInstance": true,
"color": "#FADE2A",
"command": "conda activate basic38; cd docs; ./remake_docs.sh",
},
}
]
},
"esbonio.server.enabled": true,
}

"material-icon-theme.folders.associations": {
"app_dev": "generator",
},
"cSpell.words": [
"Herbie",
"meteogram",
"synopticpy",
"Timeseries"
],
"path-autocomplete.pathMappings": {
"{{root}}/": "${folder}/11ty-site/dev/app",
"{{assets}}/": "${folder}/11ty-site/dev/app/assets",
}
}
35 changes: 25 additions & 10 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,45 @@
"command": "echo Hello ${env:USER} ${env:USERNAME}"
},
{
"label": "conda activate",
"label": "Conda: create environment",
"type": "shell",
"command": "conda activate synoptic && conda env list"
"command": "conda env create -f environment.yml"
},
{
"label": "Conda: update environment",
"type": "shell",
"command": "conda env update -f environment.yml --prune"
},
{
"label": "build docs",
"label": "Sphinx: Build docs",
"type": "shell",
"command": "cd docs && ./remake_docs.sh"
},
{
"label": "create conda environment",
"label": "PyPI: publish",
"type": "shell",
"command": "conda env create -f environment.yml"
"command": "conda activate pypi && python setup.py sdist bdist_wheel && twine check dist/* && twine upload --skip-existing dist/*"
},
{
"label": "update conda environment",
"label": "Build 11ty - Develop",
"detail": "Builds the full site in 'develop' mode (not tracked by Git).",
"type": "shell",
"command": "conda env update -f environment.yml --prune"
"command": "(eval \"$(conda shell.bash hook)\" && conda activate synoptic && cd 11ty-site && npm run dev)",
"problemMatcher": []
},
{
"label": "publish",
"label": "Build 11ty - Develop (Site Only)",
"detail": "Builds the site without pyscript in 'develop' mode (not tracked by Git).",
"type": "shell",
// TODO: use bumpversion
"command": "conda activate pypi && python setup.py sdist bdist_wheel && twine check dist/* && twine upload --skip-existing dist/*"
"command": "(eval \"$(conda shell.bash hook)\" && conda activate synoptic && cd 11ty-site && npm run dev:site)",
"problemMatcher": []
},
{
"label": "Build 11ty - Publish",
"detail": "Builds the full site in 'production' mode (tracked by Git).",
"type": "shell",
"command": "(eval \"$(conda shell.bash hook)\" && conda activate synoptic && cd 11ty-site && npm run build)",
"problemMatcher": []
}
]
}
16 changes: 16 additions & 0 deletions 11ty-site/.eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// const eleventyPluginFilesMinifier = require("@sherby/eleventy-plugin-files-minifier");

module.exports = function(eleventyConfig) {
// eleventyConfig.addPlugin(eleventyPluginFilesMinifier, {
// ignoreCustomFragments: [/<py-[\s\S]*?<\/py-.*?>/gm]
// });
eleventyConfig.addPassthroughCopy("pages/app/assets");
return {
dir: {
input: "pages",
layouts: "_includes/_layouts",
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
}
}
};
21 changes: 21 additions & 0 deletions 11ty-site/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Developer Guide

**TL;DR** To build the pages, do the following:

1. Install Node.js (version 16+).
```
conda install -c conda-forge nodejs
```
2. `cd 11ty-site` - Every time
3. `npm install` - Do once, or anytime a NPM dependency changes
4. `npm run dev` - Builds the full site in _develop mode_, (not tracked by Git).
5. `npm run dev:` - Builds the site without pyscrip in _develop mode_, (not tracked by Git).
6. `npm run build` - Builds the full site in _production mode_, (tracked by Git).

# SynopticPy App Organization

- `11ty-site/` contains all the files used to create the SynopticPy app pages.
- `pages/app/` Main page content
- `app/` contains the published site. Don't change anything in this directory; 11ty builds this for you.

Uses [Nunjucks](https://www.11ty.dev/docs/languages/nunjucks/) as the template language.
Loading

0 comments on commit e87d729

Please sign in to comment.