Merge branch 'source' into use-bulma

This commit is contained in:
Oliver Davies 2017-08-06 08:57:46 +01:00
commit 4e851429d8
14 changed files with 1399 additions and 584 deletions

View file

@ -9,13 +9,14 @@ branches:
cache:
directories:
- $HOME/.composer/cache
- $HOME/.yarn-cache
before_install:
- openssl aes-256-cbc -K $encrypted_01701315b81b_key -iv $encrypted_01701315b81b_iv -in deploy_key.enc -out deploy_key -d
- chmod 600 deploy_key
- eval `ssh-agent -s`
- ssh-add deploy_key
- npm install
- yarn --pure-lockfile
- composer install --prefer-dist --no-dev
script: ./publish.sh

View file

@ -185,6 +185,11 @@ events:
id: deploying-php-with-fabric
type: Lightning talk
- event: phpsw
date: '2017-09-13'
time: ~
talk: deploying-php-with-fabric
- event: phpnw17
date: '2017-10-01'
time: '09:00 - 09:45'

8
gulp-tasks/clean.js Normal file
View file

@ -0,0 +1,8 @@
var del = require('del');
module.exports = function (gulp, plugins, config) {
return function () {
del.sync('source/assets/{css,fonts,js}');
del.sync('output_*/assets/{css,fonts,js}');
}
}

6
gulp-tasks/fonts.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = function (gulp, plugins, config) {
return function () {
return gulp.src('node_modules/font-awesome/fonts/*')
.pipe(gulp.dest(config.fonts.outputDir));
}
}

11
gulp-tasks/scripts.js Normal file
View file

@ -0,0 +1,11 @@
module.exports = function (gulp, plugins, config, sourceFiles, outputFile) {
return function () {
return gulp.src(sourceFiles)
.pipe(plugins.plumber())
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
.pipe(plugins.concat(outputFile))
.pipe(plugins.if(config.production, plugins.uglify()))
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
.pipe(gulp.dest(config.js.outputDir));
}
}

16
gulp-tasks/styles.js Normal file
View file

@ -0,0 +1,16 @@
module.exports = function (gulp, plugins, config, sourceFiles, outputFile) {
return function () {
return gulp.src(sourceFiles)
.pipe(plugins.plumber())
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
.pipe(plugins.sassGlob())
.pipe(plugins.sass())
.pipe(plugins.autoprefixer(config.sass.autoprefixer))
.pipe(plugins.concat(outputFile))
.pipe(plugins.if(config.production, plugins.purifycss(config.sass.purifyCss)))
.pipe(plugins.if(config.production, plugins.cleanCss()))
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
.pipe(plugins.if(!config.production, plugins.refresh()))
.pipe(gulp.dest(config.sass.outputDir));
}
}

8
gulp-tasks/watch.js Normal file
View file

@ -0,0 +1,8 @@
module.exports = function (gulp, plugins, config) {
return function () {
plugins.refresh.listen();
gulp.watch(config.sass.sourceDir + config.sass.pattern, ['styles']);
gulp.watch(config.js.sourceDir + config.js.pattern, ['scripts']);
}
}

27
gulpfile.config.js Normal file
View file

@ -0,0 +1,27 @@
module.exports = function (plugins) {
return {
sass: {
autoprefixer: {
browsers: ["last 2 versions", "> 5%"],
cascade: false
},
sourceDir: "assets/sass",
pattern: "/**/*.sass",
purifyCss: [
'source/**/*.html',
'source/**/*.md',
'source/**/*.twig'
],
outputDir: "source/assets/css"
},
fonts: {
outputDir: "source/assets/fonts"
},
js: {
sourceDir: "assets/js",
pattern: "/**/*.js",
outputDir: "source/assets/js"
},
production: !!plugins.util.env.production
}
}

41
gulpfile.js Normal file
View file

@ -0,0 +1,41 @@
'use strict';
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var config = require('./gulpfile.config')(plugins);
function getTask(task) {
return require('./gulp-tasks/' + task)(gulp, plugins, config);
}
function addStyle(sourceFiles, outputFile) {
return require('./gulp-tasks/styles')(gulp, plugins, config, sourceFiles, outputFile);
}
function addScript(sourceFiles, outputFile) {
return require('./gulp-tasks/scripts')(gulp, plugins, config, sourceFiles, outputFile);
}
gulp.task('clean', getTask('clean'));
gulp.task('default', ['clean', 'fonts', 'styles', 'scripts']);
gulp.task('fonts', getTask('fonts'));
gulp.task('styles',
addStyle([
'node_modules/font-awesome/css/font-awesome.css',
'node_modules/prismjs/themes/prism-twilight.css',
config.sass.sourceDir + '/main.sass'
], 'site.css')
);
gulp.task('scripts',
addScript([
'node_modules/jquery/dist/jquery.js',
'node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
'node_modules/prismjs/prism.js',
'node_modules/prismjs/components/prism-{apacheconf,bash,css,diff,ini,json,nginx,php,sass,scss,sql,less,twig,xml,yaml}.js',
config.js.sourceDir + config.js.pattern
], 'site.js')
);
gulp.task('watch', ['default'], getTask('watch'));

View file

@ -1,52 +1,23 @@
{
"config": {
"cssOutputDir": "source/assets/css/",
"cssOutputFile": "main.css",
"fontsDir": "source/assets/fonts/",
"jsInputDir": "assets/js/",
"jsOutputDir": "source/assets/js/",
"jsOutputFile": "site.js",
"sassDir": "assets/sass/"
},
"scripts": {
"build": "npm run clean && npm-run-all -p sass js fonts:copy",
"clean": "npm-run-all -p sass:clean fonts:clean js:clean",
"dev": "npm run development",
"development": "cross-env ENV=dev npm run build",
"fonts:clean": "rm -rf $npm_package_config_fontsDir output_*/assets/fonts/",
"fonts:copy": "mkdir -p $npm_package_config_fontsDir && cp -R node_modules/font-awesome/fonts/* $npm_package_config_fontsDir",
"js": "npm run js:concat",
"js:clean": "rm -rf $npm_package_config_jsOutputDir output_*/assets/js/",
"js:concat": "mkdir -p $npm_package_config_jsOutputDir && concat node_modules/jquery/dist/jquery.js node_modules/bootstrap-sass/assets/javascripts/bootstrap.js node_modules/prismjs/prism.js node_modules/prismjs/components/prism-apacheconf.js node_modules/prismjs/components/prism-bash.js node_modules/prismjs/components/prism-css.js node_modules/prismjs/components/prism-diff.js node_modules/prismjs/components/prism-ini.js node_modules/prismjs/components/prism-json.js node_modules/prismjs/components/prism-json.js node_modules/prismjs/components/prism-less.js node_modules/prismjs/components/prism-nginx.js node_modules/prismjs/components/prism-php.js node_modules/prismjs/components/prism-sass.js node_modules/prismjs/components/prism-scss.js node_modules/prismjs/components/prism-sql.js node_modules/prismjs/components/prism-twig.js node_modules/prismjs/components/prism-yaml.js $npm_package_config_jsInputDir/**/*.js $npm_package_config_jsInputDir/main.js -o $npm_package_config_jsOutputDir$npm_package_config_jsOutputFile",
"js:watch": "onchange $npm_package_config_jsInputDir -v -- npm run js",
"prod": "npm run production",
"production": "cross-env ENV=prod npm run build",
"sass": "npm run sass:$ENV:compile && npm run sass:concat && npm run sass:$ENV:move",
"sass:clean": "rm -rf $npm_package_config_cssOutputDir output_*/assets/css/",
"sass:concat": "mkdir -p $npm_package_config_cssOutputDir && concat node_modules/font-awesome/css/font-awesome.css node_modules/prismjs/themes/prism-twilight.css $npm_package_config_cssOutputFile -o $npm_package_config_cssOutputFile",
"sass:dev:compile": "node-sass assets/sass/main.sass $npm_package_config_cssOutputFile --source-map true",
"sass:dev:move": "mv $npm_package_config_cssOutputFile $npm_package_config_cssOutputFile.map $npm_package_config_cssOutputDir",
"sass:prod:compile": "node-sass assets/sass/main.sass $npm_package_config_cssOutputFile",
"sass:prod:move": "mv $npm_package_config_cssOutputFile $npm_package_config_cssOutputDir && npm run sass:uglify",
"sass:uglify": "uglifycss --ugly-comments $npm_package_config_cssOutputDir/$npm_package_config_cssOutputFile --output $npm_package_config_cssOutputDir/$npm_package_config_cssOutputFile",
"sass:watch": "ENV=dev onchange $npm_package_config_sassDir -v -- npm run sass",
"watch": "npm run dev && cross-env ENV=dev npm-run-all -p sass:watch js:watch"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"concat": "^1.0.3",
"copy": "^0.3.0",
"cross-env": "^5.0.1",
"node-sass": "^4.5.3",
"npm-run-all": "^4.0.2",
"onchange": "^3.2.1",
"purify-css": "^1.2.5",
"uglifycss": "^0.0.27"
},
"dependencies": {
"bootstrap-sass": "^3.3.7",
"bulma": "^0.4.4",
"bulma": "^0.5.0",
"del": "^3.0.0",
"font-awesome": "^4.7.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-clean-css": "^3.7.0",
"gulp-concat": "^2.6.1",
"gulp-if": "^2.0.2",
"gulp-load-plugins": "^1.5.0",
"gulp-plumber": "^1.1.0",
"gulp-purifycss": "^0.2.0",
"gulp-refresh": "^1.1.0",
"gulp-sass": "^3.1.0",
"gulp-sass-glob": "^1.0.8",
"gulp-sourcemaps": "^2.6.0",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.8",
"jquery.2": "^1.0.0",
"prismjs": "^1.6.0"
}

View file

@ -16,7 +16,7 @@ popd
rm -rf ${BUILD_DIR}/**/* || exit 0
# Re-generate the site.
npm run prod
node_modules/.bin/gulp --production
vendor/bin/sculpin generate --no-interaction --clean --env=prod
touch output_prod/.nojekyll

View file

@ -13,7 +13,7 @@
{% include 'og' with { og: page.meta.og } %}
<link rel="stylesheet" href="{{ site.url }}/assets/css/main.css">
<link rel="stylesheet" href="{{ site.url }}/assets/css/site.css">
{% block stylesheets '' %}
{% for size in site.apple_touch_icon_sizes %}

View file

@ -19,6 +19,9 @@ meta:
width: 1280
height: 800
type: image/png
slug: deploying-php-fabric
redirect:
- talks/deploying-php-applications-with-fabric/
---
Youve built your application, and now you just need to deploy it. There are various ways that this could be done from (S)FTP, to SCP and rsync, to running commands like “git pull” and “composer install” directly on the server (not recommended).

1790
yarn.lock

File diff suppressed because it is too large Load diff