This project was created with Parcel. For familiarization and setting additional features refer to documentation.
parcel-project-template
to the name of your project.npm install
command.npm start
command.src/sass
folder and imported into the page stylesheets. For example, for index.html
the style file is named index.scss
.src/images
folder. The assembler optimizes them, but only when deploying the production version of the project. All this happens in the cloud so as not to burden your computer, as it can take a long time on weak machines.To set up a project deployment, you need to perform a few additional steps to set up your repository. Go to the Settings
tab and in the Actions
subsection select the General
item.
Scroll the page to the last section, in which make sure the options are selected as in the following image and click Save
. Without these settings, the build will not have enough rights to automate the deployment process.
The production version of the project will be automatically built and deployed to GitHub Pages, in the gh-pages
branch, every time the main
branch is updated. For example, after a direct push or an accepted pull request. To do this, you need to edit the homepage
field and the build
script in the package.json
file, replacing your_username
and your_repo_name
with your own, and submit the changes to GitHub.
"homepage": "https://your_username.github.io/your_repo_name/",
"scripts": {
"build": "parcel build src/*.html --public-url /your_repo_name/"
},
Next, you need to go to the settings of the GitHub repository (Settings
> Pages
) and set the distribution of the production version of files from the /root
folder of the gh-pages
branch, if this was not done automatically.
The deployment status of the latest commit is displayed with an icon next to its ID.
More detailed information about the status can be viewed by clicking on the icon, and in the drop-down window, follow the link Details
.
After some time, usually a couple of minutes, the live page can be viewed at the address specified in the edited homepage
property. For example, here is a link to a live version for this repository
https://goitacademy.github.io/parcel-project-template.
If a blank page opens, make sure there are no errors in the Console
tab related to incorrect paths to the CSS and JS files of the project (404). Most likely you have the wrong value for the homepage
property or the build
script in the package.json
file.
main
branch of the GitHub repository, a special script (GitHub Action) is launched from the .github/workflows/deploy.yml
file.gh-pages
branch. Otherwise, the script execution log will indicate what the problem is.