ADD grunt

This commit is contained in:
unpregnant 2017-02-18 17:54:26 +01:00
parent d31a08f18d
commit f20686c75b
21 changed files with 105 additions and 9 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ npm-debug.*
node_modules
electroshot-config.json
.nyc_output/
public/javascript.js.map

41
Gruntfile.js Executable file
View File

@ -0,0 +1,41 @@
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'public/javascript.js': 'src/public/javascript.js'
}
}
},
execute: {
target: {
options: {
nodeargs: ['--harmony-async-await']
},
src: ['src/less.js']
}
},
watch: {
app: {
files: [
'src/**/*.js',
'resumes/**/*.mustache',
'resumes/**/*.less',
'less/**/*.less'
],
tasks: ['execute', 'babel'],
options: {
nospawn: false,
livereload: true
}
}
}
});
grunt.registerTask('default', ['babel', 'execute', 'watch']);
};

32
GruntfilePdf.js Normal file
View File

@ -0,0 +1,32 @@
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'public/javascript.js': 'src/public/javascript.js'
}
}
},
execute: {
less: {
options: {
nodeargs: ['--harmony-async-await']
},
src: ['src/less.js']
},
pdf: {
options: {
nodeargs: ['--harmony-async-await']
},
src: ['src/generatePdfs.js']
}
}
});
grunt.registerTask('default', ['babel', 'execute']);
};

View File

@ -16,15 +16,13 @@
"cv",
"curriculum",
"vitae",
"electron"
"electron",
"grunt"
],
"scripts": {
"server": "node --harmony-async-await src/app.js",
"less": "node --harmony-async-await src/less.js",
"babel": "babel --presets es2015 src/public/javascript.js -o public/javascript.js",
"start": "npm run babel && npm run less && npm run server",
"dev": "watch 'npm start' src/ resumes/ less/",
"pdf": "npm run babel && npm run less && node --harmony-async-await src/generatePdfs.js",
"dev": "concurrently --kill-others \"npm run server\" \"grunt --verbose\"",
"pdf": "concurrently \"npm run server\" \"grunt --gruntfile GruntfilePdf.js --verbose\"",
"lint": "eslint src/",
"test": "nyc mocha --harmony-async-await \"test/*.js\"",
"istanbul": "istanbul cover node_modules/.bin/_mocha -- -- -u exports test/**/* --harmony-async-await"
@ -43,6 +41,7 @@
"hogan-express": "0.5.2",
"html-pdf": "2.1.0",
"html-to-pdf": "0.1.11",
"http": "0.0.0",
"jquery": "3.1.1",
"less": "2.7.2",
"less-plugin-clean-css": "1.5.1",
@ -62,12 +61,24 @@
"roboto-fontface": "0.7.0",
"showdown": "1.6.3",
"typeface-chivo": "0.0.22",
"watch": "1.0.1",
"write": "0.3.2"
},
"devDependencies": {
"concurrently": "^3.3.0",
"eslint": "3.15.0",
"grunt": "^1.0.1",
"grunt-babel": "^6.0.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-less": "^1.4.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-execute": "^0.2.2",
"grunt-run": "^0.6.0",
"grunt-shell": "^2.1.0",
"jit-grunt": "^0.10.0",
"load-grunt-tasks": "^3.5.2",
"mocha": "3.2.0",
"nyc": "10.1.2"
"nyc": "10.1.2",
"reload": "^1.1.1"
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
public/javascript.js Executable file → Normal file
View File

@ -129,3 +129,4 @@ var fixResume = function fixResume() {
};
fixResume();
//# sourceMappingURL=javascript.js.map

0
public/styles/resume-grey-boxes.min.css vendored Normal file → Executable file
View File

0
public/styles/resume-left-right.min.css vendored Normal file → Executable file
View File

0
public/styles/resume-oblique.min.css vendored Normal file → Executable file
View File

0
public/styles/resume-side-bar.min.css vendored Normal file → Executable file
View File

0
public/styles/resume-spotify.min.css vendored Normal file → Executable file
View File

0
public/styles/resume-wanted.min.css vendored Normal file → Executable file
View File

0
public/styles/style.min.css vendored Normal file → Executable file
View File

View File

@ -6,7 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="/style.min.css" rel="stylesheet">
<script src="/reload/reload.js"></script>
<title>Best resume ever</title>
<script src="//127.0.0.1:35729/livereload.js"></script>
</head>
<body>

View File

@ -15,6 +15,7 @@
{{>content}}
<script src="/javascript.js"></script>
<script src="//127.0.0.1:35729/livereload.js"></script>
</body>
</html>

View File

@ -4,6 +4,8 @@ const request = require('request-promise');
const Config = require('./Config');
const Util = require('./Util');
const person = require('./person.js');
const http = require('http');
const reload = require('reload');
let app, resumes;
const Server = {
@ -68,6 +70,10 @@ const Server = {
Server.setRoute('/' + resume, resume + '/index');
}
},
autoReload: function() {
const server = http.createServer(app);
reload(server, app);
},
/**
* run server
* @return {Promise} resolves when server is running
@ -80,6 +86,7 @@ const Server = {
Server.setKillRoute();
Server.kill();
await Util.setTimeout(500);
Server.autoReload();
Server.start();
}
};