Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modernize deploy procedure #34

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015"]
"presets": ["@babel/preset-env"]
}
9 changes: 4 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
git checkout gh-pages
git merge master
jade views/{index,404}.jade -o . -pretty
git add .
gulp deploy
git add index.html
git add 404.html
git commit -m 'deploy'
git pull
git push
git checkout master
echo "I'll no longer pull and push for you, please push with causion on which remote you'd like to."
25 changes: 22 additions & 3 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import path from 'path';
import sass from 'gulp-sass';
import jade from 'gulp-jade';
import plumber from 'gulp-plumber';
import inlinesource from 'gulp-inline-source';
import replace from 'gulp-replace';

const app = express();

const build_path = '_public';
const deploy_path = './';

gulp.task('sass', () =>
gulp.src('sass/*.sass')
Expand Down Expand Up @@ -57,6 +60,22 @@ gulp.task('watch', () => {
gulp.watch('js/*js', ['js']);
});

gulp.task('build', ['jade', 'sass', 'js', 'assets']);
gulp.task('dev', ['build', 'server', 'watch']);
gulp.task('default', ['build']);
gulp.task('inlinesource', function () {
return gulp.src([`${build_path}/index.html`, `${build_path}/404.html`])
.pipe(replace(/<script type="text\/javascript" src="\/(js\/index.js)"><\/script>/g, '<div id="script"><script inline type="text/javascript" src="$1"></script></div>'))
/* // uncommand to inline all scripts / css
.pipe(replace(/<script type="text\/javascript" src="\/(.*?.js)">/g, '<script inline type="text/javascript" src="$1">'))
.pipe(replace(/<link rel="stylesheet" (type="text\/css" )??href="\/(.*?.css)">/g, '<link inline rel="stylesheet" type="text/css" href="$2">'))
*/
.pipe(inlinesource({
compress: false,
rootpath: path.resolve(`${build_path}`)
}))
.pipe(gulp.dest(`${deploy_path}`));
});

gulp.task('build', gulp.parallel('jade', 'sass', 'js', 'assets'));
gulp.task('dev', gulp.series('build', 'server', 'watch'));
gulp.task('deploy', gulp.series('build', 'inlinesource'));

gulp.task('default', gulp.series('build'));
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@
"engines": {
"node": "0.10.x"
},
"dependencies": {},
"devDependencies": {
"babel-core": "^6.7.2",
"babel-preset-es2015": "^6.6.0",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/register": "^7.0.0",
"compass-mixins": "^0.12.7",
"connect-livereload": "^0.5.4",
"express": "^4.13.4",
"gulp": "^3.9.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-babel": "^8.0.0",
"gulp-inline-source": "^3.2.0",
"gulp-jade": "^1.1.0",
"gulp-plumber": "^1.1.0",
"gulp-refresh": "^1.1.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^2.2.0",
"gulp-util": "^3.0.7"
"gulp-util": "^3.0.8"
},
"repository": {
"type": "git",
"url": "https://github.com/hackfoldr/hackfoldr-2.0"
},
"repository": [
{
"type": "git",
"url": "https://github.com/hackfoldr/hackfoldr-2.0"
}
],
"license": "MIT"
}