Add gulp file + plugins to work on deploy script

This commit is contained in:
Jennifer Mann
2017-05-10 11:16:50 -04:00
parent d869ad4d44
commit 66ea22a793
3 changed files with 115 additions and 14 deletions
+51 -8
View File
@@ -3,9 +3,9 @@
## Source: https://github.com/hexojs/hexo/
# Site
title: Cypress.io
subtitle:
description:
title: Cypress.io Documentation
subtitle: Testing, the way it should be.
description: Cypress is a test engine that runs unit and integration tests in your browser. It makes it easy to write and debug web application tests.
author: Cypress.io
language: en
@@ -18,14 +18,10 @@ permalink_defaults:
logo: img/logo.png
github: cypress-io/cypress-documentation
github_main_repo: cypress-io/cypress
# Directory
source_dir: source
public_dir: public
tag_dir: tags
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
@@ -46,6 +42,7 @@ future: true
highlight:
enable: true
line_number: false
auto_detect: true
# Category & Tag
default_category: uncategorized
@@ -64,16 +61,24 @@ time_format: HH:mm:ss
per_page: 10
pagination_dir: page
twitter_username: Cypress_io
facebook_username: cypressio
github_username: cypress-io
github_main_repo: cypress-io/cypress
email: support@cypress.io
gitter: cypress-io/cypress
# Disqus settings
# _your_disqus_short_name_
disqus_shortname: cypress-documentation
fb_admins: 909781955804405
# Google Plugins
google:
analytics_id: UA-59606812-1
optimize_id: GTM-PHT3GCP
tag_manager_id: GTM-PHT3GCP
## Algolia Search
## https://github.com/LouisBarranqueiro/hexo-algoliasearch
algolia:
@@ -86,6 +91,7 @@ algolia:
## Themes: https://hexo.io/themes/
theme: cypress
## https://github.com/mamboer/hexo-renderer-scss
node_sass:
outputStyle: nested
precision: 5
@@ -96,6 +102,43 @@ sitemap:
path: sitemap.xml
template: ./sitemap_template.xml
## https://github.com/mamboer/hexo-filter-cleanup
hfc_useref:
enable: true
concat: true
exclude:
hfc_html:
enable: true
exclude:
hfc_css:
enable: true
exclude:
- '*.min.css'
hfc_js:
enable: true
mangle: true
output:
compress:
exclude:
- '*.min.js'
hfc_img:
enable: true
interlaced: false
multipass: false
optimizationLevel: 2
pngquant: false
progressive: false
webp: true
webpQuality: 75
gifslice: true
jpegtran: true
jpegrecompress: false
jpegrecompressQuality: 'medium'
optipng: true
svgo: true
hfc_favicons:
enable: false
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
+52
View File
@@ -0,0 +1,52 @@
var gulp = require('gulp')
var RevAll = require('gulp-rev-all')
var clean = require('gulp-clean')
var debug = require('gulp-debug')
var runSequence = require('run-sequence')
var revisionOpts = {
dontGlobal: ['.ico', 'sitemap.xml', 'logo.png'],
dontRenameFile: ['.html', 'CNAME'],
dontSearchFile: ['.js'],
debug: true
}
function remove(folder) {
return gulp
.src(folder)
.pipe(clean())
}
gulp.task('revision', function () {
return gulp
.src('public/**')
.pipe(RevAll.revision(revisionOpts))
.pipe(gulp.dest('tmp'))
})
gulp.task('copyTmpToPublic', function(){
return gulp
.src('tmp/**')
.pipe(gulp.dest('public'))
})
gulp.task('clean:js', function(){
return remove('public/js/!(application).js')
})
gulp.task('clean:tmp', function(){
return remove('tmp')
})
gulp.task('clean:public', function(){
return remove('public')
})
gulp.task('cname', function(){
gulp.src('CNAME')
.pipe(gulp.dest('public'))
})
gulp.task('prep', function (cb) {
runSequence('clean:js', 'revision', 'clean:public', 'copyTmpToPublic', 'clean:tmp', 'cname', cb)
})
+12 -6
View File
@@ -7,30 +7,36 @@
"version": "3.3.1"
},
"scripts": {
"start": "hexo server --port 2222",
"clean": "hexo clean",
"convert": "node ./cy_scripts/convert.js",
"generate": "hexo generate",
"deploy": "hexo deploy --generate"
"deploy": "npm run build && hexo deploy",
"prep": "gulp prep",
"build": "hexo clean && hexo generate && npm run prep",
"start": "hexo server --port 2222"
},
"author": "Cypress.io",
"license": "ISC",
"devDependencies": {
"colors": "^1.1.2",
"fs-extra": "^2.1.2",
"fs-extra": "^3.0.1",
"glob": "^7.1.1",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-debug": "^3.1.0",
"gulp-rev-all": "^0.9.7",
"run-sequence": "^1.2.2",
"underscore.string": "^3.3.4",
"yamljs": "^0.2.10"
},
"dependencies": {
"bluebird": "^3.5.0",
"hexo": "^3.2.0",
"hexo": "3.3.1",
"hexo-algoliasearch": "^0.2.1",
"hexo-deployer-git": "^0.2.0",
"hexo-generator-archive": "^0.1.4",
"hexo-generator-category": "^0.1.3",
"hexo-generator-index": "^0.2.0",
"hexo-generator-sitemap": "^1.1.2",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-marked": "^0.2.10",
"hexo-renderer-scss": "^1.0.2",
"hexo-server": "^0.2.0",