Restructure and add build process#1
Draft
rossjrw wants to merge 4 commits into
Draft
Conversation
An NPM-based build process (https://www.npmjs.com) generates some files that are really annoying if they're saved in the Git repository. Adding these files to a .gitignore file forces Git to ignore them. This commit adds the following to the .gitignore: node_modules/ - Contains all the code for the dependencies installed by NPM, and their dependencies, and their dependencies, and so on. Even if the project only needs a few dependencies, this directory can quickly become huge, and inflate the overall filesize of the repository. Because everything here can quickly be reinstalled with a single command - npm install - there's no reason to include in in version control. package-lock.json - A file that locks the versions of this project's NPM dependencies. It's supposed to be used for easily rolling back a repository to see which version of which dependency introduced a bug, and it's generally recommended that it should be committed. However, I've never used it, and I generally find that it's more of a nuisance than anything else. dist/ - This is the directory that contains the output of the build process: the compiled, minified CSS files. These files belong in the gh-pages branch - they should never be committed to the main branch, which is why the directory is marked as ignored.
docs/ was a GitHub-specific folder for distributing content via GitHub Pages, that are intended for distribution of documentation. We'll be converting the deployment process to an automatic build, so this naming scheme is no longer required. This commit effectively switches to more standard directory naming conventions by having the source files be in the src/ dir. Example of these conventions: https://github.com/kriasoft/Folder-Structure-Conventions
There were some old minified CSS files in src/min/. There are not supposed to be any minified source files - minification is for distribution files - so these had to be removed. However, I'm not sure which if any of them are still being used, and as myself and Grombald discussed, it's not possible to dynamically generate them using Git versioning because they were created before the codebase moved to Git. Instead, I've moved them to a legacy/ dir, and I will configure the task runner to move these files directly to the minified distribution dir when the project is built. New files should not be created in the legacy/ dir.
This commit adds Gulp, a task runner, to build the CSS. If `npm run build` is run on the command line, Gulp will build the project by passing all CSS through PostCSS and moving all the files to dist/. The dist/ directory is in the .gitignore, so developers building the project on their local machine will not commit it to the repository. Later, I will set up a GitHub Actions workflow that builds the project on every commit to the main branch. Instead of committing the dist/ directory to the main branch, it will be committed to the gh-pages branch. PostCSS is not currently configured to do anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a draft Pull Request for the restructuring changes we discussed. This PR is marked as a draft, so the little icon is grey instead of green, and you can't merge it. Once I've finished making my changes, I'll mark it as ready, the little icon will turn green, and you'll be able to merge it if you choose.
I edit and comment on my PRs frequently with notes to myself and stuff. If you have a question about what I'm doing, feel free to ask it here.
This PR must accomplish the following tasks, which I'll check off as I complete them:
docs/tosrc/For the Actions workflow, I'm thinking of having a
latestendpoint that always has the latest version of the CSS, and then also an endpoint for each version (1.0.0,1.3.0,1.3.8, etc). Thelatestendpoint would be updated after every commit to the main branch; the version endpoints would only be updated every time a new release is created.