question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Something wrong on my project github page deployment

See original GitHub issue

Hello, After following this: https://www.npmjs.com/package/generator-jekyllized#github-pages js and css continue without adding /jekyllized/... to the paths under sitefolder.

This is what i got: link rel=“stylesheet” href="/assets/stylesheets/style.min.css

This is what I wish: link rel=“stylesheet” href=“/jekyllized/assets/stylesheets/style.min.css”

What’s wrong on my gulp file? Please any help would be apreciated.

This is the repo: https://github.com/t0t/jekyllized/tree/master

thanks a lot! captura de pantalla 2015-06-08 a las 13 22 15

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
sergimiralcommented, May 20, 2016

As commented above, gulp-inject changes some paths and the workaround proposed works. Furthermore, I needed to do some more changes but I think I got it working - leaving it here just in case it helps someone & for future reference.

1 – Added baseurl: /project-name to _config.build.yml

2 – In gulpfile.babel.js changed the inject:header section from:

gulp.task('inject:head', () =>
  gulp.src('src/_includes/head.html')
    .pipe($.inject(gulp.src('.tmp/assets/stylesheets/*.css',
                            {read: false}), {ignorePath: '.tmp'}
    .pipe(gulp.dest('src/_includes'))
);

to:

gulp.task('inject:head', () =>
  gulp.src('src/_includes/head.html')
    .pipe($.inject(gulp.src('.tmp/assets/stylesheets/*.css',
                          {read: false}), {addPrefix: '{{ site.baseurl }}', ignorePath: '.tmp', addRootSlash:false}))
    .pipe(gulp.dest('src/_includes'))
);

3 – In gulpfile.babel.js changed the inject:footer section from:

gulp.task('inject:footer', () =>
  gulp.src('src/_layouts/default.html')
    .pipe($.inject(gulp.src('.tmp/assets/javascript/*.js',
                          {read: false}), {ignorePath: '.tmp'}))
    .pipe(gulp.dest('src/_layouts'))
);

to:

gulp.task('inject:footer', () =>
  gulp.src('src/_layouts/default.html')
    .pipe($.inject(gulp.src('.tmp/assets/javascript/*.js',
                          {read: false}), {addPrefix: '{{ site.baseurl }}', ignorePath: '.tmp', addRootSlash:false}))
    .pipe(gulp.dest('src/_layouts'))
);

4 – In default.html changed this:

<script src="/assets/javascript/index.min.js"></script>

to:

<script src="{{ site.baseurl }}/assets/javascript/index.min.js"></script>

5 – In header.html changed this:

<link rel="stylesheet" href="/assets/stylesheets/style.min.css">

to:

<link rel="stylesheet" href="{{ site.baseurl }}/assets/stylesheets/style.min.css">

6 – Now everything works locally and before deploying to gh-pages one should run gulp build --prod, so the baseurl variable added in the _config_build.yml file is taken in consideration – then gulp deploy

0reactions
emilianoscommented, Feb 25, 2016

Ok, so I had a similar problem with baseurl, and found out that gulp was injecting (gulp-inject), styles and js so there was no point in changing the href in the templates (they were getting overridden every time).

I finally was able to accomplish it by editing my gulpfile as follows:

from:

gulp.task('inject:head', () =>
  gulp.src('src/_includes/head.html')
    .pipe($.inject(gulp.src('.tmp/assets/stylesheets/*.css',
                            {read: false}), {ignorePath: '.tmp'}
    .pipe(gulp.dest('src/_includes'))
);

to:

gulp.task('inject:head', () =>
  gulp.src('src/_includes/head.html')
    .pipe($.inject(gulp.src('.tmp/assets/stylesheets/*.css',
                            {read: false}), {addPrefix: '{{ site.baseurl }}', ignorePath: '.tmp', addRootSlash:false}))
    .pipe(gulp.dest('src/_includes'))
);

Just noting this down for future reference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build errors during deployment to GitHub Pages · Issue #209
I am failed to deploy the ai-folio theme in my personal repository. Even I don't find any fruitful reason why it is happening....
Read more >
Deploying to Github Pages? Don't Forget to Fix Your Links
Is your site not working after deploying to Github Pages? Learn the #1 reason why deployments to Github Pages fail and how to...
Read more >
Github pages fails to deploy - Stack Overflow
Make sure you delete previous failing actions and just re-run the latest one. It should work now. – Zoran Pandovski. Mar 28, 2022...
Read more >
Cannot Deploy Site Via GitHub - Help - Jekyll Talk
Try rename Index.html to index.html and delete your CNAME. Keep things simple to get it working. You can also try make a copy...
Read more >
Deploying to GitHub Pages - Codecademy
Every time you make a change to your site, use the normal GitHub flow. That is, use git commit and git push to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found