Answer the question
In order to leave comments, you need to log in
How to deploy a gulp-built project to git?
All according to instructions from the Internet.
The gulp-gh-pages page describes a deployment in a couple of lines.
Parameters that are not specified in the example by default:
options.remoteUrl
- by default takes the current link to the repository https://github.com/имя/имя-репозитрия
,
options.branch
by default gulpfile.jsgh-pages
code with the code for deployment .
When running, not on the master(main) command , but , the error is:
npm run deploy
deploy = gulp deploy
TypeError: Cannot read property '0' of null
at Function.module.exports.Commit.actor (С:\...\node_modules\gift\lib\commit.js)
at Function.module.exports.Commit.parse_commits (C:\..\node_modules\gift\lib\commit.js:111:21)
at C:\...\node_modules\gift\lib\commit.js:55:39
at ChildProcess.exithandler (child_process.js:294:7)
at ChildProcess.exithandler (child_process.js:294:7)
at ChildProcess.EventEmitter.emit (domain.js:506:15)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
at Process.callbackTrampoline (internal/async_hooks.js:120:14)
...
npm ERR! [email protected] deploy: `gulp deploy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
...
<img src="" />
, I checked my html, there are no empty ones. gh-pages
compiled project?
Answer the question
In order to leave comments, you need to log in
In the repository on Github, you need to create a new branch named 'gh-pages' . Go to the repository's Settings, scroll down to GitHub Pages and specify this branch in the settings.
And in gulpfile.js you need to write the path where the compiled project is located, something like this
const gulp = require('gulp');
const ghPages = require('gulp-gh-pages');
gulp.task('deploy', function() {
return gulp.src('./dist/**/*')
.pipe(ghPages());
});
Make a task in package json.
gulp build - a task from galp to build the project, gh-pages -d build will automatically create the gh-pages branch, and throw the assembled project into it and change all the settings, so you just need to open the site using the link.
Before that, create a repository, and connect the remote to the local one.
"scripts": {
"deploy": "gulp build && gh-pages -d build"
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question