Workings of something like a resume
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
.bowerrc
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
README.md
bower.json
gulpfile.babel.js
package.json

README.md

Resume

Personal resume for 2015 designed in browser.

Automatically converted to PDF by injecting the styles inline with Gulp Replace and then exported using html-pdf. Automated with Gulp.

Replace inline styles

gulp.task('html', () => {
  return gulp.src('app/*.html')
    ...
    // Replace the call to load the CSS with inline styles for print
    .pipe($.replace(/<link rel=stylesheet href=([^\.]+\.css)[^>]*>/g, function(s) {
      let style = fs.readFileSync('dist/styles/main.css', 'utf8');
      return '<style media="all">\n' + style + '\n</style>';
    }))
    ...
    .pipe(gulp.dest('dist'));
});

Create a PDF export task using html-pdf

gulp.task('pdf', ['PRIOR-TASKS'], () => {
  const html = fs.readFileSync('./dist/index.html', 'utf8');
  const options = {
    format: 'A4'
  }
  pdf.create(html, options).toFile('./resume.pdf', function(err, res) {
    if (err) return console.log(err);
    console.log(res);
  });
});