jsonresume-theme-timeline
Advanced tools
Comparing version 0.0.3 to 0.0.4
var schema = require('resume-schema'); | ||
var resume = schema.resumeJson; | ||
var fs = require('fs'); | ||
resume = JSON.parse(fs.readFileSync(__dirname + '/resume.json')); | ||
var theme = require('..'); | ||
@@ -6,0 +6,0 @@ |
48
index.js
@@ -7,2 +7,4 @@ | ||
var gravatar = require('gravatar'); | ||
function render (resume) { | ||
@@ -13,2 +15,46 @@ | ||
var csscustom = fs.readFileSync(path.resolve(__dirname, 'css','custom.css'), 'utf8'); | ||
var files = {}; | ||
csscustom = csscustom.replace(/url\(["']?(\S*)\.(png|jpg|jpeg|gif)["']?\)/g, function(match, file, type) | ||
{ | ||
var fileName = file + '.' + type; | ||
var size = fs.statSync(fileName).size; | ||
if (size > 4096) { | ||
console.log('Skipping ' + fileName + ' (' + (Math.round(size/1024*100)/100) + 'k)'); | ||
return match; | ||
} | ||
else { | ||
var base64 = fs.readFileSync(fileName).toString('base64'); | ||
if (typeof(files[fileName]) !== 'undefined') { | ||
console.log('Warning: ' + fileName + ' has already been base64 encoded in the css'); | ||
} | ||
files[fileName] = true; | ||
return 'url("data:image/' + (type === 'jpg' ? 'jpeg' : type) + ';base64,' + base64 + '")'; | ||
} | ||
}); | ||
cssbootstrap = cssbootstrap.replace(/url\(["']?(\S*)\.(png|jpg|jpeg|gif)["']?\)/g, function(match, file, type) | ||
{ | ||
var fileName = file + '.' + type; | ||
var size = fs.statSync(fileName).size; | ||
if (size > 4096) { | ||
console.log('Skipping ' + fileName + ' (' + (Math.round(size/1024*100)/100) + 'k)'); | ||
return match; | ||
} | ||
else { | ||
var base64 = fs.readFileSync(fileName).toString('base64'); | ||
if (typeof(files[fileName]) !== 'undefined') { | ||
console.log('Warning: ' + fileName + ' has already been base64 encoded in the css'); | ||
} | ||
files[fileName] = true; | ||
return 'url("data:image/' + (type === 'jpg' ? 'jpeg' : type) + ';base64,' + base64 + '")'; | ||
} | ||
}); | ||
var cssdark = fs.readFileSync(path.resolve(__dirname, 'css','dark.css'), 'utf8'); | ||
@@ -18,3 +64,3 @@ var template = fs.readFileSync(path.resolve(__dirname, 'index.html'), 'utf8'); | ||
resume.bio.gravatar = gravatar.url(resume.bio.email.personal, { | ||
s: '100', | ||
s: '200', | ||
r: 'pg', | ||
@@ -21,0 +67,0 @@ d: 'mm' |
{ | ||
"name": "jsonresume-theme-timeline", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2449636
102
15914