deploying a project without .html files #111116
Replies: 4 comments 2 replies
-
Deploying your project with GitHub Pages requires the content to be in static HTML, CSS, and JavaScript files as far as I know, GitHub Pages serves static content, which dont includes template engines like Handlebars. When you converted your project to use Handlebars, your project likely became dependent on Node.js to render the HTML content from the Handlebars templates at runtime. To deploy your Handlebars-based project on GitHub Pages, you will need to convert your Handlebars templates back into static HTML files. Maybe a website like this coud help you translating templates to html: https://www.takeymakey.com/convert/code/handlebars-to-html/ I hope it helped you ^^ |
Beta Was this translation helpful? Give feedback.
-
GitHub Pages is designed to host static websites, meaning it primarily supports HTML, CSS, and JavaScript files1. When you converted your project to use Handlebars (a templating engine for Node.js), it became a dynamic application. GitHub Pages doesn’t natively support server-side languages like Node.js, which is required to render Handlebars templates into HTML. |
Beta Was this translation helpful? Give feedback.
-
I would not know the extent of your application but all BE is not for GitHub Pages, but if you are advanced enough, you can separate the logic of frontend and backend, so your full frontend only runs using GitHub Pages and your CRUD through backend's API, much like the GitHub API that any frontend service can use regarding your situation, I think Copilot has a great suggestion but I don't know if it's applicable in your situation, this is like pre-building the static site, here it is If you want to stick with GitHub Pages, you'll need to pre-render your Handlebars templates into HTML. This can be done as part of your build process. For example, you could use a task runner like Gulp or Grunt to compile your Handlebars templates into HTML files whenever you make changes. These HTML files can then be served by GitHub Pages. Here's a basic example of how you might set up a Gulp task to compile Handlebars templates: const gulp = require('gulp');
const handlebars = require('gulp-compile-handlebars');
const rename = require('gulp-rename');
gulp.task('templates', function () {
const templateData = {}, // Your template data goes here
options = {
ignorePartials: true,
batch: ['./src/partials']
};
return gulp.src('src/**/*.handlebars')
.pipe(handlebars(templateData, options))
.pipe(rename({ extname: '.html' }))
.pipe(gulp.dest('dist'));
}); This Gulp task compiles all Handlebars templates in the |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hello. i just discovered "github pages". i want to deploy a project. it was originally a project consisting of html files, but then i converted it to .handlebars files using node.js. now i want to deploy the final version of my project, but it didn't work. but it worked with the initial html files. could you help me?
Beta Was this translation helpful? Give feedback.
All reactions