Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Replace gulp-util
Browse files Browse the repository at this point in the history
Signed-off-by: Dillon Bailey <dillon@honestfox.com.au>
  • Loading branch information
dillonbailey authored and benjtinsley committed Jan 16, 2018
1 parent 12475be commit 6626413
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 46 deletions.
7 changes: 4 additions & 3 deletions extras/tasks/iconFont/generateIconSass.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ var gulp = require('gulp')
var render = require('gulp-nunjucks-render')
var rename = require('gulp-rename')
var handleErrors = require('../../lib/handleErrors')
var gutil = require('gulp-util')
var log = require('fancy-log')
var colors = require('ansi-colors')
var data = require('gulp-data')

module.exports = function(config) {
return function(glyphs, options) {
gutil.log(gutil.colors.blue('Generating ' + config.sassDest + '/' + config.sassOutputName))
log(colors.blue('Generating ' + config.sassDest + '/' + config.sassOutputName))
render.nunjucks.configure(config.nunjucks, { watch: false })

return gulp.src(config.template)
.pipe(data({
icons: glyphs.map(function(glyph) {
gutil.log(gutil.colors.green('+ adding ' + glyph.name + ' glyph'))
log(colors.green('+ adding ' + glyph.name + ' glyph'))
return {
name: glyph.name,
code: glyph.unicode[0].charCodeAt(0).toString(16).toUpperCase()
Expand Down
5 changes: 3 additions & 2 deletions extras/tasks/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ var compress = require('compression')
var config = require('../config')
var express = require('express')
var gulp = require('gulp')
var gutil = require('gulp-util')
var log = require('fancy-log')
var colors = require('ansi-colors')
var logger = require('morgan')
var open = require('open')
var path = require('path')
Expand All @@ -26,7 +27,7 @@ var serverTask = function() {
.use('/', express.static(settings.root, settings.staticOptions))
.listen(settings.port)

gutil.log('production server started on ' + gutil.colors.green(url))
log('production server started on ' + colors.green(url))
open(url)
}

Expand Down
10 changes: 6 additions & 4 deletions gulpfile.js/lib/compileLogger.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
var gutil = require("gulp-util")
var PluginError = require('plugin-error')
var log = require('fancy-log')
var colors = require('ansi-colors')
var prettifyTime = require('./prettifyTime')
var handleErrors = require('./handleErrors')

module.exports = function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err)
if(err) throw new PluginError("webpack", err)

var statColor = stats.compilation.warnings.length < 1 ? 'green' : 'yellow'

Expand All @@ -14,7 +16,7 @@ module.exports = function(err, stats) {
})
} else {
var compileTime = prettifyTime(stats.endTime - stats.startTime)
gutil.log(gutil.colors[statColor](stats))
gutil.log('Compiled with', gutil.colors.cyan('webpack'), 'in', gutil.colors.magenta(compileTime))
log(colors[statColor](stats))
log('Compiled with', colors.cyan('webpack'), 'in', colors.magenta(compileTime))
}
}
11 changes: 6 additions & 5 deletions gulpfile.js/tasks/http2-upgrade.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
const gulp = require('gulp')
const gutil = require('gulp-util')
const log = require('fancy-log')
const colors = require('ansi-colors')
const mergeStream = require('merge-stream')
const path = require('path')
const del = require('del')

gulp.task('http2-upgrade', function() {
del([path.resolve(process.env.PWD, PATH_CONFIG.src, PATH_CONFIG.stylesheets.src)], { force: true })
gutil.log(gutil.colors.green('Cleaned stylesheets directory'))
log(colors.green('Cleaned stylesheets directory'))

const configStream = gulp.src('extras/http2/**/*')
.pipe(gulp.dest(process.env.PWD))

const srcStream = gulp.src(['src/stylesheets', 'src/javascripts', 'src/html'])
.pipe(gulp.dest(path.join(process.env.PWD, PATH_CONFIG.src)))

gutil.log(gutil.colors.green('Created HTTP/2 ready stylesheets directory'))
gutil.log(gutil.colors.green('Added some HTTP/2 helpers to the html directory'))
gutil.log(gutil.colors.green('Created config/path-config.json'))
log(colors.green('Created HTTP/2 ready stylesheets directory'))
log(colors.green('Added some HTTP/2 helpers to the html directory'))
log(colors.green('Created config/path-config.json'))

return mergeStream(configStream, srcStream)
})
5 changes: 3 additions & 2 deletions gulpfile.js/tasks/init-config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
var gulp = require('gulp')
var gutil = require('gulp-util')
var log = require('fancy-log')
var colors = require('ansi-colors')
var path = require('path')
var merge = require('merge-stream')

gulp.task('init-config', function() {
var configStream = gulp.src(['gulpfile.js/path-config.json', 'gulpfile.js/task-config.js'])
.pipe(gulp.dest(path.join(process.env.PWD, 'config')))

gutil.log(gutil.colors.green('Adding default path-config.json and task-config.js files to ./config/'))
log(colors.green('Adding default path-config.json and task-config.js files to ./config/'))

return configStream
})
13 changes: 7 additions & 6 deletions gulpfile.js/tasks/init-craft.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const gulp = require('gulp')
const gutil = require('gulp-util')
const log = require('fancy-log')
const colors = require('ansi-colors')
const mergeStream = require('merge-stream')
const path = require('path')

Expand All @@ -11,11 +12,11 @@ gulp.task('init-craft', function() {
.pipe(gulp.dest(path.join(process.env.PWD, PATH_CONFIG.src)))


gutil.log(gutil.colors.green('Added gulpRev plugin to craft/plugins/gulprev!'))
gutil.log(gutil.colors.green('Created config/path-config.json'))
gutil.log(gutil.colors.green('Created config/task-config.js'))
gutil.log(
gutil.colors.green(`Blendid is configured for Craft!
log(colors.green('Added gulpRev plugin to craft/plugins/gulprev!'))
log(colors.green('Created config/path-config.json'))
log(colors.green('Created config/task-config.js'))
log(
colors.green(`Blendid is configured for Craft!
Next Steps
==========
Expand Down
21 changes: 11 additions & 10 deletions gulpfile.js/tasks/init-drupal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const gulp = require('gulp')
const gutil = require('gulp-util')
const log = require('fancy-log')
const colors = require('ansi-colors')
const rename = require('gulp-rename')
const replace = require('gulp-replace')
const mergeStream = require('merge-stream')
Expand All @@ -18,15 +19,15 @@ gulp.task('init-drupal', function() {
const srcStream = gulp.src(['extras/drupal/src/**/*', '*.gitkeep'])
.pipe(gulp.dest(path.join(process.env.PWD, PATH_CONFIG.src)))

gutil.log(gutil.colors.green('Created config/path-config.json'))
gutil.log(gutil.colors.green('Created config/task-config.js'))
gutil.log(gutil.colors.green('Created config/install/'+ envBasename +'.settings.yml'))
gutil.log(gutil.colors.green('Created config/schema/'+ envBasename +'.schema.yml'))
gutil.log(gutil.colors.green('Created '+ envBasename +'.info.yml'))
gutil.log(gutil.colors.green('Created '+ envBasename +'.libraries.yml'))
gutil.log(gutil.colors.green('Created '+ envBasename +'.theme'))
gutil.log(
gutil.colors.green(`Blendid is configured for Drupal!
log(colors.green('Created config/path-config.json'))
log(colors.green('Created config/task-config.js'))
log(colors.green('Created config/install/'+ envBasename +'.settings.yml'))
log(colors.green('Created config/schema/'+ envBasename +'.schema.yml'))
log(colors.green('Created '+ envBasename +'.info.yml'))
log(colors.green('Created '+ envBasename +'.libraries.yml'))
log(colors.green('Created '+ envBasename +'.theme'))
log(
colors.green(`Blendid is configured for Drupal!
Next Steps
==========
Expand Down
19 changes: 10 additions & 9 deletions gulpfile.js/tasks/init-rails.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
var gulp = require('gulp')
var gutil = require('gulp-util')
var log = require('fancy-log')
var colors = require('ansi-colors')

gulp.task('init-rails', function() {
var stream = gulp.src(['extras/rails/**/*', '*!README.md'])
.pipe(gulp.dest(process.env.PWD))

gutil.log(gutil.colors.green('Created app/helpers/blendid_asset_helper.rb'))
gutil.log(gutil.colors.green('Created config/initializers/blendid.rb'))
gutil.log(gutil.colors.green('Created config/deploy.rb.example'))
gutil.log(
gutil.colors.yellow(`
log(colors.green('Created app/helpers/blendid_asset_helper.rb'))
log(colors.green('Created config/initializers/blendid.rb'))
log(colors.green('Created config/deploy.rb.example'))
log(
colors.yellow(`
Using Capistrano? Add the following to deploy.rb so assets will compile on deploy:
`), gutil.colors.magenta(`
`), colors.magenta(`
namespace :deploy do
namespace :npm do
task :install, :roles => :app do
Expand All @@ -26,11 +27,11 @@ end
# Run NPM install after assets:precompile
before "deploy:assets:precompile", "deploy:npm:install"
`), gutil.colors.magenta(`
`), colors.magenta(`
Make sure to add 'public/assets' to your .gitignore file.
`), gutil.colors.magenta(`
`), colors.magenta(`
Update the script and stylesheet tags in your layout with the blendid asset helpers:
<link rel="stylesheet" href="<%= blendid_css_path('app.css') %>" />
Expand Down
9 changes: 5 additions & 4 deletions gulpfile.js/tasks/init.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var gulp = require('gulp')
var gutil = require('gulp-util')
var log = require('fancy-log')
var colors = require('ansi-colors')
var path = require('path')
var merge = require('merge-stream')

Expand All @@ -13,10 +14,10 @@ gulp.task('init', function() {
var srcStream = gulp.src(['src/**/*', '*.gitkeep'])
.pipe(gulp.dest(path.join(process.env.PWD, PATH_CONFIG.src)))

gutil.log(gutil.colors.green('Generating default Blendid project files'))
gutil.log(gutil.colors.yellow(`
log(colors.green('Generating default Blendid project files'))
log(colors.yellow(`
To start the dev server:
`), gutil.colors.magenta(`
`), colors.magenta(`
yarn run blendid
,`))

Expand Down
1 change: 0 additions & 1 deletion gulpfile.js/tasks/rev/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
if(!TASK_CONFIG.production.rev) return

var gulp = require('gulp')
var gutil = require('gulp-util')
var gulpSequence = require('gulp-sequence')

var updateHtml = TASK_CONFIG.html ? 'update-html' : false
Expand Down

0 comments on commit 6626413

Please sign in to comment.